-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task/part2 rendering of entities #1288
Merged
fgalan
merged 4 commits into
feature/1259_new_json_for_v2
from
task/part2_rendering_of_entities
Sep 25, 2015
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -519,52 +519,58 @@ std::string ContextAttribute::render | |
* the code paths of the rendering process | ||
* | ||
*/ | ||
std::string ContextAttribute::toJson(bool isLastElement, bool types) | ||
std::string ContextAttribute::toJson(bool isLastElement, bool types, const std::string& renderMode) | ||
{ | ||
std::string out; | ||
|
||
if (types == true) | ||
{ | ||
out = JSON_STR(name) + ":{" + JSON_STR("type") + ":" + JSON_STR(type) + "}"; | ||
} | ||
else if ((type == "") && (metadataVector.size() == 0)) | ||
else if ((renderMode == "values") || (renderMode == "keyValues")) | ||
{ | ||
out = (renderMode == "keyValues")? JSON_STR(name) + ":" : ""; | ||
|
||
if (compoundValueP != NULL) | ||
{ | ||
if (compoundValueP->isObject()) | ||
{ | ||
out = JSON_STR(name) + ":{" + compoundValueP->toJson(true) + "}"; | ||
out += "{" + compoundValueP->toJson(true) + "}"; | ||
} | ||
else if (compoundValueP->isVector()) | ||
{ | ||
out = JSON_STR(name) + ":[" + compoundValueP->toJson(true) + "]"; | ||
out += "[" + compoundValueP->toJson(true) + "]"; | ||
} | ||
} | ||
else if (valueType == orion::ValueTypeNumber) | ||
{ | ||
char num[32]; | ||
|
||
snprintf(num, sizeof(num), "%f", numberValue); | ||
out = JSON_VALUE_NUMBER(name, num); | ||
out += num; | ||
} | ||
else if (valueType == orion::ValueTypeString) | ||
{ | ||
out = JSON_VALUE(name, stringValue); | ||
out += JSON_STR(stringValue); | ||
} | ||
else if (valueType == orion::ValueTypeBoolean) | ||
{ | ||
out = JSON_VALUE_BOOL(name, boolValue); | ||
out += (boolValue == true)? "true" : "false"; | ||
} | ||
} | ||
else | ||
else // Render mode: normalized | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code comnets should be aligned with spec. In this particular case, I'm not sure if "normalized" will be a term used in the spec. However, again, until things get clear I'm afraid cannot fix this. NTC |
||
{ | ||
out = JSON_STR(name) + ":{"; | ||
|
||
if (type != "") | ||
{ | ||
out += JSON_VALUE("type", type) + ","; | ||
} | ||
// | ||
// type | ||
// | ||
out += (type != "")? JSON_VALUE("type", type) : JSON_STR("type") + ":" + "null"; | ||
out += ","; | ||
|
||
|
||
// | ||
// value | ||
// | ||
if (compoundValueP != NULL) | ||
{ | ||
if (compoundValueP->isObject()) | ||
|
@@ -596,11 +602,12 @@ std::string ContextAttribute::toJson(bool isLastElement, bool types) | |
{ | ||
out += JSON_VALUE("value", stringValue); | ||
} | ||
out += ","; | ||
|
||
if (metadataVector.size() > 0) | ||
{ | ||
out += "," + metadataVector.toJson(true); | ||
} | ||
// | ||
// metadata | ||
// | ||
out += JSON_STR("metadata") + ":" + "{" + metadataVector.toJson(true) + "}"; | ||
|
||
out += "}"; | ||
} | ||
|
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
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 |
---|---|---|
|
@@ -39,6 +39,7 @@ static const char* validOptions[] = | |
"count", | ||
"normalized", | ||
"values", | ||
"keyValues", | ||
"text" | ||
}; | ||
|
||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunatelly, "keyValues" seems that will not be used at the end. However, the issue is still under discussion, so probably the best strategy is to progress this PR without changes, then fix it in a next PR once it gets clear. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I really believe that would be easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the end seems that "keyValues" will be used. Keep tunned :)
NTC