40 std::cout <<
"storage::set_val \"" << key <<
"\" = " << value << std::endl;
42 if (!value)
data.erase (key);
54 std::cout <<
"storage::get_val \"" << key <<
"\" = " <<
data[key] << std::endl;
56 std::cout <<
"storage::get_val no such key \"" << key <<
"\"" << std::endl;
58 if (
data.find (key) ==
data.end ())
return 0;
59 else return data[key];
80 return pair<string, s_int32> (NULL, 0);
90 map<const char*, storage*, ltstr>::iterator j;
93 for (j =
data.begin (); j !=
data.end (); j++)
94 if (strcmp ((*j).first, key) == 0)
97 std::cout <<
"*** objects::set: key already exists: '" << key <<
"'\n";
98 std::cout <<
"*** container contents: ";
100 for (j =
data.begin (); j !=
data.end (); j++)
101 std::cout <<
"'" << (*j).first <<
"', ";
103 std::cout <<
"\n\n" << flush;
116 map<const char*, storage*, ltstr>::iterator j;
119 for (j =
data.begin (); j !=
data.end (); j++)
120 if (strcmp ((*j).first, key) == 0)
124 std::cout <<
"*** objects::get: key does not exist: '" << key <<
"'\n";
125 std::cout <<
"*** container contents: ";
127 for (j =
data.begin (); j !=
data.end (); j++)
128 cout <<
"'" << (*j).first <<
"', ";
130 cout <<
"\n\n" << flush;
158 if (i ==
data.end ())
164 return (*i++).second;
storage * next()
Returns the next storage in the object.
#define s_int32
32 bits long signed integer
void erase(const char *key)
Erases a storage from it's key.
s_int32 & operator[](string key)
Returns the value of a key.
storage * get_val(const char *key)
Returns a storage associated to a key.
void set_val(string key, s_int32 value)
Sets key to value.
s_int32 get_val(string key)
Returns the value of a key.
pair< string, s_int32 > next()
Returns the next (key, value) pair of the storage.
Declares the storage and objects classes.
void set_val(const char *key, storage *val)
Associates an object to a key.