annotate src/projectm-1.0/ConfigFile.cxx @ 3103:b562bc52a93e

ported OSS
author Michal Lipski <tallica@o2.pl>
date Thu, 30 Apr 2009 18:06:46 +0200
parents a6d84a2cfaa7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1920
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
1 // ConfigFile.cpp
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
2
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
3 #include "ConfigFile.h"
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
4
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
5 using std::string;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
6
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
7 ConfigFile::ConfigFile( string filename, string delimiter,
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
8 string comment, string sentry )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
9 : myDelimiter(delimiter), myComment(comment), mySentry(sentry)
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
10 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
11 // Construct a ConfigFile, getting keys and values from given file
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
12
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
13 std::ifstream in( filename.c_str() );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
14
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
15 if( !in ) throw file_not_found( filename );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
16
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
17 in >> (*this);
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
18 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
19
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
20
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
21 ConfigFile::ConfigFile()
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
22 : myDelimiter( string(1,'=') ), myComment( string(1,'#') )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
23 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
24 // Construct a ConfigFile without a file; empty
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
25 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
26
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
27
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
28 void ConfigFile::remove( const string& key )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
29 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
30 // Remove key and its value
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
31 myContents.erase( myContents.find( key ) );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
32 return;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
33 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
34
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
35
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
36 bool ConfigFile::keyExists( const string& key ) const
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
37 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
38 // Indicate whether key is found
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
39 mapci p = myContents.find( key );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
40 return ( p != myContents.end() );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
41 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
42
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
43
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
44 /* static */
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
45 void ConfigFile::trim( string& s )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
46 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
47 // Remove leading and trailing whitespace
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
48 static const char whitespace[] = " \n\t\v\r\f";
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
49 s.erase( 0, s.find_first_not_of(whitespace) );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
50 s.erase( s.find_last_not_of(whitespace) + 1U );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
51 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
52
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
53
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
54 std::ostream& operator<<( std::ostream& os, const ConfigFile& cf )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
55 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
56 // Save a ConfigFile to os
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
57 for( ConfigFile::mapci p = cf.myContents.begin();
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
58 p != cf.myContents.end();
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
59 ++p )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
60 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
61 os << p->first << " " << cf.myDelimiter << " ";
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
62 os << p->second << std::endl;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
63 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
64 return os;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
65 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
66
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
67
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
68 std::istream& operator>>( std::istream& is, ConfigFile& cf )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
69 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
70 // Load a ConfigFile from is
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
71 // Read in keys and values, keeping internal whitespace
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
72 typedef string::size_type pos;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
73 const string& delim = cf.myDelimiter; // separator
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
74 const string& comm = cf.myComment; // comment
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
75 const string& sentry = cf.mySentry; // end of file sentry
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
76 const pos skip = delim.length(); // length of separator
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
77
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
78 string nextline = ""; // might need to read ahead to see where value ends
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
79
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
80 while( is || nextline.length() > 0 )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
81 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
82 // Read an entire line at a time
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
83 string line;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
84 if( nextline.length() > 0 )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
85 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
86 line = nextline; // we read ahead; use it now
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
87 nextline = "";
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
88 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
89 else
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
90 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
91 std::getline( is, line );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
92 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
93
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
94 // Ignore comments
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
95 line = line.substr( 0, line.find(comm) );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
96
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
97 // Check for end of file sentry
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
98 if( sentry != "" && line.find(sentry) != string::npos ) return is;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
99
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
100 // Parse the line if it contains a delimiter
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
101 pos delimPos = line.find( delim );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
102 if( delimPos < string::npos )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
103 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
104 // Extract the key
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
105 string key = line.substr( 0, delimPos );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
106 line.replace( 0, delimPos+skip, "" );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
107
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
108 // See if value continues on the next line
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
109 // Stop at blank line, next line with a key, end of stream,
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
110 // or end of file sentry
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
111 bool terminate = false;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
112 while( !terminate && is )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
113 {
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
114 std::getline( is, nextline );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
115 terminate = true;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
116
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
117 string nlcopy = nextline;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
118 ConfigFile::trim(nlcopy);
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
119 if( nlcopy == "" ) continue;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
120
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
121 nextline = nextline.substr( 0, nextline.find(comm) );
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
122 if( nextline.find(delim) != string::npos )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
123 continue;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
124 if( sentry != "" && nextline.find(sentry) != string::npos )
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
125 continue;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
126
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
127 nlcopy = nextline;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
128 ConfigFile::trim(nlcopy);
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
129 if( nlcopy != "" ) line += "\n";
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
130 line += nextline;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
131 terminate = false;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
132 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
133
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
134 // Store key and value
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
135 ConfigFile::trim(key);
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
136 ConfigFile::trim(line);
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
137 cf.myContents[key] = line; // overwrites if key is repeated
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
138 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
139 }
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
140
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
141 return is;
a6d84a2cfaa7 projectm-1.0: add the new files this time
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
diff changeset
142 }