ソースを参照

Make extract value public

Alexey Edelev 4 年 前
コミット
df045ecf45
2 ファイル変更12 行追加11 行削除
  1. 11 11
      microjson.cpp
  2. 1 0
      microjson.h

+ 11 - 11
microjson.cpp

@@ -284,17 +284,6 @@ void findSeparator(const char *buffer, size_t size, size_t &i, const char expect
     }
 }
 
-bool extractValue(const char *buffer, size_t size, size_t &i, const char expectedEndByte, microjson::JsonProperty &property) {
-    if (size == 0) {
-        i = SIZE_MAX;
-        return false;
-    }
-    lookForValue(buffer, size, i, property);
-    findSeparator(buffer, size, i, expectedEndByte);
-
-    return property.checkValue();
-}
-
 using Extractor = bool(*)(const char *, size_t, size_t &, const char, microjson::JsonProperty &);
 
 template<typename R,
@@ -351,6 +340,17 @@ void appendValue(const char* buffer, microjson::JsonArray &values, const microjs
 
 }
 
+bool microjson::extractValue(const char *buffer, size_t size, size_t &i, const char expectedEndByte, microjson::JsonProperty &property) {
+    if (size == 0) {
+        i = SIZE_MAX;
+        return false;
+    }
+    lookForValue(buffer, size, i, property);
+    findSeparator(buffer, size, i, expectedEndByte);
+
+    return property.checkValue();
+}
+
 bool microjson::extractProperty(const char *buffer, size_t size, size_t &i, const char expectedEndByte, microjson::JsonProperty &property) {
     if (size == 0) {
         i = SIZE_MAX;

+ 1 - 0
microjson.h

@@ -97,5 +97,6 @@ inline bool skipWhiteSpace(const char byte) {
     return byte == '\n' || byte == ' ' || byte == '\r' || byte == '\t' || byte == '\f' || byte == '\v';
 }
 
+extern bool extractValue(const char *buffer, size_t size, size_t &i, const char expectedEndByte, microjson::JsonProperty &property);
 extern bool extractProperty(const char *buffer, size_t size, size_t &i, const char expectedEndByte, microjson::JsonProperty &property);
 }