Browse Source

[3408] Added a few comments in the data.cc concerning element position.

Marcin Siodelski 11 years ago
parent
commit
6725cdd4ec
1 changed files with 12 additions and 0 deletions
  1. 12 0
      src/lib/cc/data.cc

+ 12 - 0
src/lib/cc/data.cc

@@ -401,7 +401,10 @@ numberFromStringstream(std::istream& in, int& pos) {
 ElementPtr
 ElementPtr
 fromStringstreamNumber(std::istream& in, const std::string& file,
 fromStringstreamNumber(std::istream& in, const std::string& file,
                        const int& line, int& pos) {
                        const int& line, int& pos) {
+    // Remember position where the value starts. It will be set in the
+    // Position structure of the Element to be created.
     const uint32_t start_pos = pos;
     const uint32_t start_pos = pos;
+    // This will move the pos to the end of the value.
     const std::string number = numberFromStringstream(in, pos);
     const std::string number = numberFromStringstream(in, pos);
 
 
     if (number.find_first_of(".eE") < number.size()) {
     if (number.find_first_of(".eE") < number.size()) {
@@ -427,7 +430,10 @@ ElementPtr
 fromStringstreamBool(std::istream& in, const std::string& file,
 fromStringstreamBool(std::istream& in, const std::string& file,
                      const int line, int& pos)
                      const int line, int& pos)
 {
 {
+    // Remember position where the value starts. It will be set in the
+    // Position structure of the Element to be created.
     const uint32_t start_pos = pos;
     const uint32_t start_pos = pos;
+    // This will move the pos to the end of the value.
     const std::string word = wordFromStringstream(in, pos);
     const std::string word = wordFromStringstream(in, pos);
 
 
     if (boost::iequals(word, "True")) {
     if (boost::iequals(word, "True")) {
@@ -445,7 +451,10 @@ ElementPtr
 fromStringstreamNull(std::istream& in, const std::string& file,
 fromStringstreamNull(std::istream& in, const std::string& file,
                      const int line, int& pos)
                      const int line, int& pos)
 {
 {
+    // Remember position where the value starts. It will be set in the
+    // Position structure of the Element to be created.
     const uint32_t start_pos = pos;
     const uint32_t start_pos = pos;
+    // This will move the pos to the end of the value.
     const std::string word = wordFromStringstream(in, pos);
     const std::string word = wordFromStringstream(in, pos);
     if (boost::iequals(word, "null")) {
     if (boost::iequals(word, "null")) {
         return (Element::create(Element::Position(line, start_pos)));
         return (Element::create(Element::Position(line, start_pos)));
@@ -460,7 +469,10 @@ ElementPtr
 fromStringstreamString(std::istream& in, const std::string& file, int& line,
 fromStringstreamString(std::istream& in, const std::string& file, int& line,
                        int& pos)
                        int& pos)
 {
 {
+    // Remember position where the value starts. It will be set in the
+    // Position structure of the Element to be created.
     const uint32_t start_pos = pos;
     const uint32_t start_pos = pos;
+    // This will move the pos to the end of the value.
     const std::string string_value = strFromStringstream(in, file, line, pos);
     const std::string string_value = strFromStringstream(in, file, line, pos);
     return (Element::create(string_value, Element::Position(line, start_pos)));
     return (Element::create(string_value, Element::Position(line, start_pos)));
 }
 }