Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed memleak and added keys functionality.
- Loading branch information
Showing
12 changed files
with
68 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "GobjectImplKeys.hpp" | ||
namespace jsonme { | ||
GobjectImplKeys::GobjectImplKeys(JsonNode* node) { | ||
if (json_node_get_node_type(node) == JSON_NODE_OBJECT) { | ||
JsonObject *asObject=json_node_get_object(node); | ||
if (asObject) { | ||
GList *members=json_object_get_members(asObject); | ||
if (members) { | ||
for (GList *member=members;member;member=member->next) { | ||
mKeys.push_back(std::string((char *) member->data)); | ||
} | ||
g_list_free(members); | ||
} | ||
} | ||
} | ||
} | ||
std::string GobjectImplKeys::operator[](size_t index) const { return mKeys[index];} | ||
size_t GobjectImplKeys::size() const{ | ||
return mKeys.size(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef _JSONME_GOBJIMPLKEYS_HPP | ||
#define _JSONME_GOBJIMPLKEYS_HPP | ||
#include "../json-me.hpp" | ||
#include <glib-object.h> | ||
#include <json-glib/json-glib.h> | ||
#include <string> | ||
#include <vector> | ||
#include <iostream> | ||
namespace jsonme { | ||
class GobjectImplKeys: public AbstractKeys { | ||
std::vector<std::string> mKeys; | ||
public: | ||
GobjectImplKeys(JsonNode* node); | ||
~GobjectImplKeys() throw() {} | ||
std::string operator[](size_t index) const; | ||
size_t size() const; | ||
}; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters