ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Represent/Represent.cpp
(Generate patch)

Comparing Represent/Represent.cpp (file contents):
Revision 400 by douglas, 2004-12-27T19:19:23-08:00 vs.
Revision 422 by douglas, 2005-03-09T19:08:17-08:00

# Line 75 | Line 75 | void Represent::parse()
75                  query = content;
76          }
77  
78 <        ext::Vector<ext::String> pairs(query.Split('&'));
78 >        ext::Vector<ext::String> pairs(ext::SplitAll(query, ext::String("&")));
79  
80 <        _foreach (ext::Vector<ext::String>, pair, pairs)
80 >        _foreach (const ext::Vector<ext::String>, pair, pairs)
81          {
82 <                ext::String::ConstIterator equal(pair->FindFirst('='));
82 >                ext::String::ConstIterator equal(ext::FindFirstAll(*pair, ext::String("=")));
83                  ext::String name(pair->Begin(), equal), value(equal != pair->End() ? equal + 1 : equal, pair->End());
84  
85                  cgi.insert(std::pair<std::string, std::string>(decode(name), decode(value)));
# Line 108 | Line 108 | void Represent::headings(xml::TextWriter
108          xml::ScopeElement tr(xhtml, "tr");
109          ext::String headings[] = { "Data Type", "Data Representation", "Input Type", "Storage" };
110  
111 <        _foru (index, 0, sizeof (headings) / sizeof (ext::String))
111 >        _for (unsigned, index, 0, sizeof (headings) / sizeof (ext::String))
112          {
113                  xml::ScopeElement th(xhtml, "th");
114  
# Line 127 | Line 127 | void Represent::form(xml::TextWriter& xh
127  
128                  DataType type(cgi.find("type") != cgi.end() ? cgi.find("type")->second : std::string());
129  
130 <                _foreach (ext::Vector<DataType>, type_, DataType::enumerate())
130 >                _foreach (const ext::Vector<DataType>, type_, DataType::enumerate())
131                  {
132                          xml::ScopeElement option(xhtml, "option");
133  
# Line 156 | Line 156 | void Represent::form(xml::TextWriter& xh
156  
157                  InputType input(cgi.find("input") != cgi.end() ? cgi.find("input")->second : std::string());
158  
159 <                _foreach (ext::Vector<InputType>, input_, InputType::enumerate())
159 >                _foreach (const ext::Vector<InputType>, input_, InputType::enumerate())
160                  {
161                          xml::ScopeElement option(xhtml, "option");
162  
# Line 179 | Line 179 | void Represent::output(xml::TextWriter&
179          std::set<MultiMapSize, std::greater<MultiMapSize> > count;
180          ext::String names[] = { "type", "data", "input" };
181  
182 <        _foru (index, 0, sizeof (names) / sizeof (ext::String)) count.insert(cgi.count(names[index]));
182 >        _for (unsigned, index, 0, sizeof (names) / sizeof (ext::String)) count.insert(cgi.count(names[index]));
183  
184          typedef std::multimap<std::string, std::string>::const_iterator MultiMapConstIterator;
185  
186          MultiMapConstIterator type(cgi.lower_bound("type")), type_(cgi.upper_bound("type")), data(cgi.lower_bound("data")), data_(cgi.upper_bound("data")), input(cgi.lower_bound("input")), input_(cgi.upper_bound("input"));
187          ext::Vector<Item> items;
188  
189 <        _foru (index, 0, *count.begin() < 128 ? *count.begin() : 128)
189 >        _for (unsigned, index, 0, *count.begin() < 128 ? *count.begin() : 128)
190          {
191                  Item item(DataType(type != type_ ? type->second : std::string()), data != data_ ? data->second : std::string(), InputType(input != input_ ? input->second : std::string()));
192  
# Line 256 | Line 256 | void Represent::output(xml::TextWriter&
256  
257                  ext::String names[] = { "type", "data", "input" }, values[] = { item.type, item.data, item.input };
258  
259 <                _foru (index, 0, sizeof (names) / sizeof (ext::String))
259 >                _for (unsigned, index, 0, sizeof (names) / sizeof (ext::String))
260                  {
261                          xml::ScopeElement input(xhtml, "input");
262  
# Line 369 | Line 369 | std::string Represent::input(const Item&
369          default:
370                  return item.data;
371          case InputType::INPUT_Binary:
372 <                _foreach (_L<ext::String>, atom, item.data.Split(' ')) string += Binary(*atom, false).convert<char>(false);
372 >                _foreach (const _L<ext::String>, atom, ext::SplitAll(item.data, ext::String(" "))) string += Binary(*atom, false).convert<char>(false);
373                  break;
374          case InputType::INPUT_Hexadecimal:
375 <                _foreach (_L<ext::String>, atom, item.data.Split(' ')) string += Hexadecimal(*atom, false).convert<char>(false);
375 >                _foreach (const _L<ext::String>, atom, ext::SplitAll(item.data, ext::String(" "))) string += Hexadecimal(*atom, false).convert<char>(false);
376          }
377  
378          return string;
# Line 388 | Line 388 | ext::String Represent::input(const Item&
388          default:
389                  return item.data;
390          case InputType::INPUT_Binary:
391 <                _foreach (_L<ext::String>, atom, item.data.Split(' ')) string.InsertLast(Binary(*atom, false).convert<uint32_t>(false));
391 >                _foreach (const _L<ext::String>, atom, ext::SplitAll(item.data, ext::String(" "))) string.InsertLast(Binary(*atom, false).convert<uint32_t>(false));
392                  break;
393          case InputType::INPUT_Hexadecimal:
394 <                _foreach (_L<ext::String>, atom, item.data.Split(' ')) string.InsertLast(Hexadecimal(*atom, false).convert<uint32_t>(false));
394 >                _foreach (const _L<ext::String>, atom, ext::SplitAll(item.data, ext::String(" "))) string.InsertLast(Hexadecimal(*atom, false).convert<uint32_t>(false));
395          }
396  
397          return string;
# Line 458 | Line 458 | void Represent::binary(xml::TextWriter&
458  
459          xml::ScopeElement(xhtml, "br");
460  
461 <        _foreach (ext::String, atom, string)
461 >        _foreach (const ext::String, atom, string)
462          {
463                  xml::ScopeElement(xhtml, "br");
464  
# Line 500 | Line 500 | void Represent::hexadecimal(xml::TextWri
500  
501          xml::ScopeElement(xhtml, "br");
502  
503 <        _foreach (ext::String, atom, string)
503 >        _foreach (const ext::String, atom, string)
504          {
505                  xml::ScopeElement(xhtml, "br");
506  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines