|
@@ -8,116 +8,116 @@
|
|
|
|
|
|
class Fortune {
|
|
class Fortune {
|
|
public:
|
|
public:
|
|
- // Check for memory error
|
|
|
|
- U_MEMORY_TEST
|
|
|
|
|
|
+ // Check for memory error
|
|
|
|
+ U_MEMORY_TEST
|
|
|
|
|
|
- // Allocator e Deallocator
|
|
|
|
- U_MEMORY_ALLOCATOR
|
|
|
|
- U_MEMORY_DEALLOCATOR
|
|
|
|
|
|
+ // Allocator e Deallocator
|
|
|
|
+ U_MEMORY_ALLOCATOR
|
|
|
|
+ U_MEMORY_DEALLOCATOR
|
|
|
|
|
|
- int id;
|
|
|
|
- UString message;
|
|
|
|
|
|
+ int id;
|
|
|
|
+ UString message;
|
|
|
|
|
|
- // CONSTRUCTOR
|
|
|
|
|
|
+ // CONSTRUCTOR
|
|
|
|
|
|
- Fortune()
|
|
|
|
- {
|
|
|
|
- U_TRACE_REGISTER_OBJECT(5, Fortune, "")
|
|
|
|
- }
|
|
|
|
|
|
+ Fortune()
|
|
|
|
+ {
|
|
|
|
+ U_TRACE_REGISTER_OBJECT(5, Fortune, "")
|
|
|
|
+ }
|
|
|
|
|
|
- Fortune(int _id, const UString& _message) : id(_id), message(_message)
|
|
|
|
- {
|
|
|
|
- U_TRACE_REGISTER_OBJECT(5, Fortune, "%d,%.*S", _id, U_STRING_TO_TRACE(_message))
|
|
|
|
- }
|
|
|
|
|
|
+ Fortune(int _id, const UString& _message) : id(_id), message(_message)
|
|
|
|
+ {
|
|
|
|
+ U_TRACE_REGISTER_OBJECT(5, Fortune, "%d,%.*S", _id, U_STRING_TO_TRACE(_message))
|
|
|
|
+ }
|
|
|
|
|
|
- Fortune(const Fortune& f) : id(f.id), message((void*)U_STRING_TO_PARAM(f.message))
|
|
|
|
- {
|
|
|
|
- U_TRACE_REGISTER_OBJECT(5, Fortune, "%p", &f)
|
|
|
|
|
|
+ Fortune(const Fortune& f) : id(f.id), message((void*)U_STRING_TO_PARAM(f.message))
|
|
|
|
+ {
|
|
|
|
+ U_TRACE_REGISTER_OBJECT(5, Fortune, "%p", &f)
|
|
|
|
|
|
- U_MEMORY_TEST_COPY(f)
|
|
|
|
- }
|
|
|
|
|
|
+ U_MEMORY_TEST_COPY(f)
|
|
|
|
+ }
|
|
|
|
|
|
- ~Fortune()
|
|
|
|
- {
|
|
|
|
- U_TRACE_UNREGISTER_OBJECT(5, Fortune)
|
|
|
|
- }
|
|
|
|
|
|
+ ~Fortune()
|
|
|
|
+ {
|
|
|
|
+ U_TRACE_UNREGISTER_OBJECT(5, Fortune)
|
|
|
|
+ }
|
|
|
|
|
|
- // SERVICE
|
|
|
|
|
|
+ // SERVICE
|
|
|
|
|
|
- bool operator<(const Fortune& other) const { return cmp_obj(&message, &other.message); }
|
|
|
|
|
|
+ bool operator<(const Fortune& other) const { return cmp_obj(&message, &other.message); }
|
|
|
|
|
|
- static int cmp_obj(const void* a, const void* b)
|
|
|
|
- {
|
|
|
|
- U_TRACE(5, "Fortune::cmp_obj(%p,%p)", a, b)
|
|
|
|
|
|
+ static int cmp_obj(const void* a, const void* b)
|
|
|
|
+ {
|
|
|
|
+ U_TRACE(5, "Fortune::cmp_obj(%p,%p)", a, b)
|
|
|
|
|
|
- return (*(const Fortune**)a)->message.compare((*(const Fortune**)b)->message);
|
|
|
|
- }
|
|
|
|
|
|
+ return (*(const Fortune**)a)->message.compare((*(const Fortune**)b)->message);
|
|
|
|
+ }
|
|
|
|
|
|
#ifdef DEBUG
|
|
#ifdef DEBUG
|
|
- const char* dump(bool breset) const
|
|
|
|
- {
|
|
|
|
- *UObjectIO::os << "id " << id << '\n'
|
|
|
|
- << "message (UString " << (void*)&message << ')';
|
|
|
|
|
|
+ const char* dump(bool breset) const
|
|
|
|
+ {
|
|
|
|
+ *UObjectIO::os << "id " << id << '\n'
|
|
|
|
+ << "message (UString " << (void*)&message << ')';
|
|
|
|
|
|
- if (breset)
|
|
|
|
- {
|
|
|
|
- UObjectIO::output();
|
|
|
|
|
|
+ if (breset)
|
|
|
|
+ {
|
|
|
|
+ UObjectIO::output();
|
|
|
|
|
|
- return UObjectIO::buffer_output;
|
|
|
|
- }
|
|
|
|
|
|
+ return UObjectIO::buffer_output;
|
|
|
|
+ }
|
|
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
#endif
|
|
#endif
|
|
|
|
|
|
private:
|
|
private:
|
|
- Fortune& operator=(const Fortune&) { return *this; }
|
|
|
|
|
|
+ Fortune& operator=(const Fortune&) { return *this; }
|
|
};
|
|
};
|
|
|
|
|
|
// ORM TEMPLATE SPECIALIZATIONS
|
|
// ORM TEMPLATE SPECIALIZATIONS
|
|
|
|
|
|
template <> class U_EXPORT UOrmTypeHandler<Fortune> : public UOrmTypeHandler_Base {
|
|
template <> class U_EXPORT UOrmTypeHandler<Fortune> : public UOrmTypeHandler_Base {
|
|
public:
|
|
public:
|
|
- explicit UOrmTypeHandler(Fortune& val) : UOrmTypeHandler_Base(&val) {}
|
|
|
|
|
|
+ explicit UOrmTypeHandler(Fortune& val) : UOrmTypeHandler_Base(&val) {}
|
|
|
|
|
|
- void bindParam(UOrmStatement* stmt) const
|
|
|
|
- {
|
|
|
|
- U_TRACE(0, "UOrmTypeHandler<Fortune>::bindParam(%p)", stmt)
|
|
|
|
|
|
+ void bindParam(UOrmStatement* stmt) const
|
|
|
|
+ {
|
|
|
|
+ U_TRACE(0, "UOrmTypeHandler<Fortune>::bindParam(%p)", stmt)
|
|
|
|
|
|
- stmt->bindParam(U_ORM_TYPE_HANDLER(Fortune, id, int));
|
|
|
|
- stmt->bindParam(U_ORM_TYPE_HANDLER(Fortune, message, UString));
|
|
|
|
- }
|
|
|
|
|
|
+ stmt->bindParam(U_ORM_TYPE_HANDLER(Fortune, id, int));
|
|
|
|
+ stmt->bindParam(U_ORM_TYPE_HANDLER(Fortune, message, UString));
|
|
|
|
+ }
|
|
|
|
|
|
- void bindResult(UOrmStatement* stmt)
|
|
|
|
- {
|
|
|
|
- U_TRACE(0, "UOrmTypeHandler<Fortune>::bindResult(%p)", stmt)
|
|
|
|
|
|
+ void bindResult(UOrmStatement* stmt)
|
|
|
|
+ {
|
|
|
|
+ U_TRACE(0, "UOrmTypeHandler<Fortune>::bindResult(%p)", stmt)
|
|
|
|
|
|
- stmt->bindResult(U_ORM_TYPE_HANDLER(Fortune, id, int));
|
|
|
|
- stmt->bindResult(U_ORM_TYPE_HANDLER(Fortune, message, UString));
|
|
|
|
- }
|
|
|
|
|
|
+ stmt->bindResult(U_ORM_TYPE_HANDLER(Fortune, id, int));
|
|
|
|
+ stmt->bindResult(U_ORM_TYPE_HANDLER(Fortune, message, UString));
|
|
|
|
+ }
|
|
};
|
|
};
|
|
|
|
|
|
// JSON TEMPLATE SPECIALIZATIONS
|
|
// JSON TEMPLATE SPECIALIZATIONS
|
|
|
|
|
|
template <> class U_EXPORT UJsonTypeHandler<Fortune> : public UJsonTypeHandler_Base {
|
|
template <> class U_EXPORT UJsonTypeHandler<Fortune> : public UJsonTypeHandler_Base {
|
|
public:
|
|
public:
|
|
- explicit UJsonTypeHandler(Fortune& val) : UJsonTypeHandler_Base(&val) {}
|
|
|
|
|
|
+ explicit UJsonTypeHandler(Fortune& val) : UJsonTypeHandler_Base(&val) {}
|
|
|
|
|
|
- void toJSON(UValue& json)
|
|
|
|
- {
|
|
|
|
- U_TRACE(0, "UJsonTypeHandler<Fortune>::toJSON(%p)", &json)
|
|
|
|
|
|
+ void toJSON(UValue& json)
|
|
|
|
+ {
|
|
|
|
+ U_TRACE(0, "UJsonTypeHandler<Fortune>::toJSON(%p)", &json)
|
|
|
|
|
|
- json.toJSON(U_JSON_TYPE_HANDLER(Fortune, id, int));
|
|
|
|
- json.toJSON(U_JSON_TYPE_HANDLER(Fortune, message, UString));
|
|
|
|
- }
|
|
|
|
|
|
+ json.toJSON(U_JSON_TYPE_HANDLER(Fortune, id, int));
|
|
|
|
+ json.toJSON(U_JSON_TYPE_HANDLER(Fortune, message, UString));
|
|
|
|
+ }
|
|
|
|
|
|
- void fromJSON(UValue& json)
|
|
|
|
- {
|
|
|
|
- U_TRACE(0, "UJsonTypeHandler<Fortune>::fromJSON(%p)", &json)
|
|
|
|
|
|
+ void fromJSON(UValue& json)
|
|
|
|
+ {
|
|
|
|
+ U_TRACE(0, "UJsonTypeHandler<Fortune>::fromJSON(%p)", &json)
|
|
|
|
|
|
- json.fromJSON(U_JSON_TYPE_HANDLER(Fortune, id, int));
|
|
|
|
- json.fromJSON(U_JSON_TYPE_HANDLER(Fortune, message, UString));
|
|
|
|
- }
|
|
|
|
|
|
+ json.fromJSON(U_JSON_TYPE_HANDLER(Fortune, id, int));
|
|
|
|
+ json.fromJSON(U_JSON_TYPE_HANDLER(Fortune, message, UString));
|
|
|
|
+ }
|
|
};
|
|
};
|
|
|
|
|
|
#endif
|
|
#endif
|