cwObject.h/cpp : Replaced use of std::int64_t and uint64_t with 'long long' and 'unsigned long long'.

This commit is contained in:
kevin 2021-12-19 12:14:30 -05:00
parent 5c069612f9
commit 5c5dc89b0f
2 changed files with 33 additions and 21 deletions

View File

@ -183,8 +183,8 @@ namespace cw
void _objTypePrintUInt16( const object_t* o, print_ctx_t& c ) { printf("%i",o->u.u16); }
void _objTypePrintInt32( const object_t* o, print_ctx_t& c ) { printf("%i",o->u.i32); }
void _objTypePrintUInt32( const object_t* o, print_ctx_t& c ) { printf("%i",o->u.u32); }
void _objTypePrintInt64( const object_t* o, print_ctx_t& c ) { printf("%" PRIx64 ,o->u.i64); }
void _objTypePrintUInt64( const object_t* o, print_ctx_t& c ) { printf("%" PRIx64 ,o->u.u64); }
void _objTypePrintInt64( const object_t* o, print_ctx_t& c ) { printf("%lli", o->u.i64); }
void _objTypePrintUInt64( const object_t* o, print_ctx_t& c ) { printf("%lli", o->u.u64); }
void _objTypePrintBool( const object_t* o, print_ctx_t& c ) { printf("%s",o->u.b ? "true" : "false"); }
void _objTypePrintFloat( const object_t* o, print_ctx_t& c ) { printf("%f",o->u.f); }
void _objTypePrintDouble( const object_t* o, print_ctx_t& c ) { printf("%f",o->u.d); }
@ -253,8 +253,8 @@ namespace cw
unsigned _objTypeToStringUInt16( const object_t* o, char* buf, unsigned n ) { return toText(buf,n,o->u.u16); }
unsigned _objTypeToStringInt32( const object_t* o, char* buf, unsigned n ) { return toText(buf,n,o->u.i32); }
unsigned _objTypeToStringUInt32( const object_t* o, char* buf, unsigned n ) { return toText(buf,n,o->u.u32); }
unsigned _objTypeToStringInt64( const object_t* o, char* buf, unsigned n ) { assert(0); /*return toText(buf,n,o->u.i64);*/ return kInvalidOpRC; }
unsigned _objTypeToStringUInt64( const object_t* o, char* buf, unsigned n ) { assert(0); /*return toText(buf,n,o->u.u64);*/ return kInvalidOpRC; }
unsigned _objTypeToStringInt64( const object_t* o, char* buf, unsigned n ) { return toText(buf,n,o->u.i64); }
unsigned _objTypeToStringUInt64( const object_t* o, char* buf, unsigned n ) { return toText(buf,n,o->u.u64); }
unsigned _objTypeToStringBool( const object_t* o, char* buf, unsigned n ) { return toText(buf,n,o->u.b); }
unsigned _objTypeToStringFloat( const object_t* o, char* buf, unsigned n ) { return toText(buf,n,o->u.f); }
unsigned _objTypeToStringDouble( const object_t* o, char* buf, unsigned n ) { return toText(buf,n,o->u.d); }
@ -721,6 +721,17 @@ cw::object_t* cw::newDictObject( object_t* parent )
cw::object_t* cw::newListObject( object_t* parent )
{ return _objAllocate( kListTId, parent ); }
cw::object_t* cw::newPairObject( const char* label, object_t* value, object_t* parent)
{
object_t* pair = _objAppendLeftMostNode(parent, _objAllocate( kPairTId, parent) );
_objCreateValueNode<const char*>( pair, label );
pair->append_child(value);
return value;
}
cw::object_t* cw::newPairObject( const char* label, std::uint8_t v, object_t* parent)
{ return _objCreatePairNode<uint8_t>( parent, label, v ); }

View File

@ -58,8 +58,8 @@ namespace cw
typedef struct print_ctx_str
{
unsigned indent = 0;
bool listOnOneLineFl = true;
unsigned indent = 0;
bool listOnOneLineFl = true;
} print_ctx_t;
typedef struct type_str
@ -103,8 +103,8 @@ namespace cw
std::uint16_t u16;
std::int32_t i32;
std::uint32_t u32;
std::int64_t i64;
std::uint64_t u64;
long long i64;
unsigned long long u64;
bool b;
@ -280,19 +280,20 @@ namespace cw
object_t* newListObject( object_t* parent=nullptr );
// Return a pointer to the value node.
object_t* newPairObject( const char* label, std::uint8_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::int8_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::int16_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::uint16_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::int32_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::uint32_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::int64_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::uint64_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, bool v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, float v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, double v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, char* v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, const char* v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, object_t* v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::uint8_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::int8_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::int16_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::uint16_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::int32_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::uint32_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::int64_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, std::uint64_t v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, bool v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, float v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, double v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, char* v, object_t* parent=nullptr);
object_t* newPairObject( const char* label, const char* v, object_t* parent=nullptr);
rc_t objectFromString( const char* s, object_t*& objRef );
rc_t objectFromFile( const char* fn, object_t*& objRef );