-
Notifications
You must be signed in to change notification settings - Fork 12
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
Move all struct and typedefs to separate header #13
Open
LuxoftAKutsan
wants to merge
2
commits into
smartdevicelink:master
Choose a base branch
from
LuxoftAKutsan:fix/fix_compilation_for_gcc4.4.2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#ifndef BSON_FWD_H | ||
#define BSON_FWD_H | ||
|
||
#include "emhashmap/emhashmap.h" | ||
|
||
//Byte which defines the type of a value as defined in the BSON spec | ||
enum element_type { | ||
TYPE_DOUBLE = 0x01, | ||
TYPE_STRING = 0x02, | ||
TYPE_DOCUMENT = 0x03, | ||
TYPE_ARRAY = 0x04, | ||
TYPE_BINARY = 0x05, //unused | ||
TYPE_UNDEFINED = 0x06, //deprecated | ||
TYPE_OBJECT_ID = 0x07, //unused | ||
TYPE_BOOLEAN = 0x08, | ||
TYPE_DATE_TIME = 0x09, //unused | ||
TYPE_NULL = 0x0A, //unused | ||
TYPE_REGEX = 0x0B, //unused | ||
TYPE_DB_POINTER = 0x0C, //deprecated | ||
TYPE_JS_CODE = 0x0D, //unused | ||
TYPE_SYMBOL = 0x0E, //deprecated | ||
TYPE_JS_CODE_WITH_SCOPE = 0x0F, //unused | ||
TYPE_INT32 = 0x10, | ||
TYPE_TIMESTAMP = 0x11, //unused | ||
TYPE_INT64 = 0x12, | ||
TYPE_DEC128 = 0x13, //unused | ||
TYPE_MIN_KEY = 0xFF, //unused | ||
TYPE_MAX_KEY = 0x7F //unused | ||
}; | ||
typedef enum element_type element_type; | ||
|
||
//Definition of each boolean value according to the BSON spec | ||
enum bson_boolean { | ||
BOOLEAN_INVALID = -1, | ||
BOOLEAN_FALSE = 0x00, | ||
BOOLEAN_TRUE = 0x01 | ||
}; | ||
typedef enum bson_boolean bson_boolean; | ||
|
||
|
||
struct BsonObject { | ||
//Internal map implementation | ||
HashMap data; | ||
}; | ||
typedef struct BsonObject BsonObject; | ||
|
||
struct BsonElement { | ||
//The value of this element | ||
void *value; | ||
//The data type of this element | ||
element_type type; | ||
//Size of the element in bytes when converted to BSON | ||
//Unused for TYPE_DOCUMENT and TYPE_ARRAY | ||
size_t size; | ||
}; | ||
typedef struct BsonElement BsonElement; | ||
|
||
struct BsonObjectEntry { | ||
char key[255]; | ||
BsonElement *element; | ||
}; | ||
typedef struct BsonObjectEntry BsonObjectEntry; | ||
|
||
//Object representing a BSON array | ||
struct BsonArray { | ||
//Array of BSON elements | ||
BsonElement **elements; | ||
//Number of elements currently in the array | ||
size_t count; | ||
//The current maximum number of elements in the array | ||
size_t maxCount; | ||
}; | ||
typedef struct BsonArray BsonArray; | ||
|
||
#endif // BSON_FWD_H |
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
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.
Header guards should be changed accordingly