ReactOS 0.4.15-dev-7924-g5949c20
hhp_key_value_section Class Reference

#include <hhp_reader.h>

Inheritance diagram for hhp_key_value_section:
Collaboration diagram for hhp_key_value_section:

Public Member Functions

virtual void process_line (string line)
 
- Public Member Functions inherited from hhp_section
virtual void process_line (string line)=0
 
string get_name ()
 
void set_name (string name)
 

Protected Member Functions

void add_entry (hhp_pair *entry)
 

Protected Attributes

map< string, hhp_pair * > entries
 

Detailed Description

Definition at line 56 of file hhp_reader.h.

Member Function Documentation

◆ add_entry()

void hhp_key_value_section::add_entry ( hhp_pair entry)
protected

Definition at line 86 of file hhp_reader.cpp.

87{
88 string upper_case_key = to_upper(entry->get_key());
89 if (entries.count(upper_case_key) != 0)
90 throw logic_error("trying to redundantly add key '" + upper_case_key + "'");
91 entries.insert(pair<string, hhp_pair*>(upper_case_key, entry));
92}
map< string, hhp_pair * > entries
Definition: hhp_reader.h:59
uint32_t entry
Definition: isohybrid.c:63
string to_upper(string s)
Definition: utils.cpp:36
Definition: _pair.h:47

Referenced by hhp_options_section::hhp_options_section().

◆ process_line()

void hhp_key_value_section::process_line ( string  line)
virtual

Implements hhp_section.

Definition at line 73 of file hhp_reader.cpp.

74{
75 int pos_equals_sign = line.find_first_of('=');
76 if (pos_equals_sign == string::npos)
77 throw runtime_error("key-value pair does not contain an equals sign");
78 string key = to_upper(line.substr(0, pos_equals_sign));
79 string value = line.substr(pos_equals_sign + 1);
80 if (key.length() == 0)
81 throw runtime_error("key has length zero");
82
83 entries.find(key)->second->set_value(value);
84}
Definition: copy.c:22
Definition: parser.c:49
Definition: pdh_main.c:94

Member Data Documentation

◆ entries

map<string, hhp_pair*> hhp_key_value_section::entries
protected

Definition at line 59 of file hhp_reader.h.

Referenced by add_entry(), and process_line().


The documentation for this class was generated from the following files: