ReactOS  0.4.15-dev-4923-g379188a
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
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
string to_upper(string s)
Definition: utils.cpp:36
uint32_t entry
Definition: isohybrid.c:63
Definition: _pair.h:47

◆ 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: pdh_main.c:93
static const size_t npos
Definition: _string_npos.h:26
map< string, hhp_pair * > entries
Definition: hhp_reader.h:59
string to_upper(string s)
Definition: utils.cpp:36
Definition: parser.c:48
Definition: copy.c:22

Member Data Documentation

◆ entries

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

Definition at line 59 of file hhp_reader.h.


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