sptk2 logo
SPTK Home Page
Classes | Public Member Functions | Protected Member Functions | Friends | List of all members
sptk::Field Class Reference

#include <Field.h>

Inheritance diagram for sptk::Field:
sptk::Variant sptk::VariantAdaptors sptk::BaseVariant sptk::DatabaseField

Classes

struct  View
 

Public Member Functions

 Field (const String &name)
 
 Field (const Field &other)=default
 
 Field (Field &&other) noexcept=default
 
Viewview ()
 
const StringfieldName () const
 
Fieldoperator= (const Field &other)=default
 
Fieldoperator= (Field &&other) noexcept=default
 
Fieldoperator= (const Variant &C)
 
Fieldoperator= (bool value) override
 
Fieldoperator= (int32_t value) override
 
Fieldoperator= (int64_t value) override
 
Fieldoperator= (double value) override
 
Fieldoperator= (const char *value) override
 
Fieldoperator= (const sptk::String &value) override
 
Fieldoperator= (DateTime value) override
 
Fieldoperator= (const uint8_t *value) override
 
Fieldoperator= (const Buffer &value) override
 
String asString () const override
 
void exportTo (const xdoc::SNode &node, bool compactXmlMode, bool detailedInfo=false, bool nullLargeData=false) const
 
String displayName () const
 
void displayName (const String &name)
 
- Public Member Functions inherited from sptk::Variant
 Variant ()
 
 Variant (bool value)
 
 Variant (int32_t value)
 
 Variant (int64_t value, unsigned scale=1)
 
 Variant (double value)
 
 Variant (const char *value)
 
 Variant (const String &v)
 
 Variant (const DateTime &v)
 
 Variant (const uint8_t *value, size_t sz)
 
 Variant (const Buffer &value)
 
 Variant (const Variant &other)=default
 
 Variant (Variant &&other) noexcept=default
 
 ~Variant () override
 
Variantoperator= (const Variant &other)
 
Variantoperator= (Variant &&other) noexcept
 
virtual Variantoperator= (bool value)
 
virtual Variantoperator= (int32_t value)
 
virtual Variantoperator= (int64_t value)
 
virtual Variantoperator= (double value)
 
virtual Variantoperator= (const MoneyData &value)
 
virtual Variantoperator= (const char *value)
 
virtual Variantoperator= (const String &value)
 
virtual Variantoperator= (DateTime value)
 
virtual Variantoperator= (const uint8_t *value)
 
virtual Variantoperator= (const Buffer &value)
 
virtual operator bool () const
 
virtual operator int () const
 
virtual operator int64_t () const
 
virtual operator uint64_t () const
 
virtual operator double () const
 
virtual operator String () const
 
virtual operator DateTime () const
 
virtual void load (const std::shared_ptr< xdoc::Node > &element)
 
void save (const std::shared_ptr< xdoc::Node > &node) const
 
- Public Member Functions inherited from sptk::VariantAdaptors
 VariantAdaptors ()=default
 Default constructor.
 
 VariantAdaptors (const VariantAdaptors &other)=default
 Copy constructor. More...
 
 VariantAdaptors (VariantAdaptors &&other) noexcept=default
 Move constructor. More...
 
 ~VariantAdaptors () override=default
 Default destructor.
 
virtual void setBool (bool value)
 
virtual void setInteger (int32_t value)
 
virtual void setInt64 (int64_t value)
 
virtual void setFloat (double value)
 
virtual void setMoney (int64_t value, unsigned scale)
 
virtual void setString (const String &value)
 
virtual void setBuffer (const uint8_t *value, size_t valueSize, VariantDataType type=VariantDataType::VAR_BUFFER)
 
virtual void setExternalBuffer (uint8_t *value, size_t valueSize, VariantDataType type=VariantDataType::VAR_BUFFER)
 
virtual void setDateTime (DateTime value, bool dateOnly=false)
 
virtual void setImagePtr (const uint8_t *value)
 
virtual void setImageNdx (uint32_t value)
 
virtual void setMoney (const MoneyData &value)
 
virtual void setNull (VariantDataType vtype=VariantDataType::VAR_NONE)
 
int asInteger () const
 
int64_t asInt64 () const
 
bool asBool () const
 
double asFloat () const
 
virtual String asString () const
 
DateTime asDate () const
 
DateTime asDateTime () const
 
const uint8_t * asImagePtr () const
 
- Public Member Functions inherited from sptk::BaseVariant
 BaseVariant ()=default
 Default constructor.
 
 BaseVariant (const BaseVariant &other)=default
 Copy constructor. More...
 
 BaseVariant (BaseVariant &&other) noexcept=default
 Move constructor. More...
 
virtual ~BaseVariant ()=default
 Destructor.
 
VariantDataType dataType () const
 
size_t dataSize () const
 
void dataSize (size_t newDataSize)
 
size_t bufferSize () const
 
bool isNull () const
 
template<typename T >
const T & get () const
 Direct and fast const access to variant data. More...
 
template<typename T >
T & get ()
 Direct and fast access to variant data. More...
 
virtual const MoneyDatagetMoney () const
 
virtual const char * getString () const
 
virtual const uint8_t * getExternalBuffer () const
 
virtual const char * getText () const
 
virtual const uint8_t * getImagePtr () const
 
virtual uint32_t getImageNdx () const
 

Protected Member Functions

virtual String doubleDataToString () const
 
- Protected Member Functions inherited from sptk::VariantAdaptors
void setData (const BaseVariant &other)
 
const char * getBufferPtr () const
 
- Protected Member Functions inherited from sptk::BaseVariant
void dataType (VariantType newDataType)
 
void dataType (VariantDataType newDataType)
 
bool isExternalBuffer () const
 
virtual String moneyDataToString () const
 

Friends

class FieldList
 

Additional Inherited Members

- Static Public Member Functions inherited from sptk::BaseVariant
static String typeName (VariantDataType type)
 
static VariantDataType nameType (const char *name)
 
- Protected Attributes inherited from sptk::BaseVariant
VariantData m_data
 Internal variant data storage.
 

Detailed Description

Data field for CDataSource.

Contains field name, field type, field data and field format information.

Constructor & Destructor Documentation

◆ Field() [1/3]

sptk::Field::Field ( const String name)
explicit

Constructor

Parameters
nameField name

◆ Field() [2/3]

sptk::Field::Field ( const Field other)
default

Copy constructor

Parameters
otherOther field object

◆ Field() [3/3]

sptk::Field::Field ( Field &&  other)
defaultnoexcept

Move constructor

Parameters
otherOther field object

Member Function Documentation

◆ asString()

String sptk::Field::asString ( ) const
overridevirtual

Better (than in base class) conversion method

Reimplemented from sptk::VariantAdaptors.

◆ exportTo()

void sptk::Field::exportTo ( const xdoc::SNode &  node,
bool  compactXmlMode,
bool  detailedInfo = false,
bool  nullLargeData = false 
) const

Exports the field data into XML node

If the compactXmlMode flag is true, the field is exported as an attribute. Otherwise, the field is exported as subnodes. For the fields of the VAR_TEXT type, the subnode is created containing CDATA section.

Parameters
nodeNode to export field data into
compactXmlModeWhen exporting to XML, export fields as attributes
detailedInfoExport extra field info such as size and type
nullLargeDataSet text data longer than 256 bytes to null

◆ fieldName()

const String & sptk::Field::fieldName ( ) const
inline

Returns field name

◆ operator=() [1/12]

Field & sptk::Field::operator= ( bool  value)
inlineoverridevirtual

Assignment operation

Reimplemented from sptk::Variant.

◆ operator=() [2/12]

Field & sptk::Field::operator= ( const Buffer value)
inlineoverridevirtual

Assignment operation

Reimplemented from sptk::Variant.

References sptk::BufferStorage::bytes(), sptk::BufferStorage::data(), and VAR_BUFFER.

◆ operator=() [3/12]

Field & sptk::Field::operator= ( const char *  value)
inlineoverridevirtual

Assignment operation

Reimplemented from sptk::Variant.

◆ operator=() [4/12]

Field & sptk::Field::operator= ( const Field other)
default

Copy assignment operation

◆ operator=() [5/12]

Field & sptk::Field::operator= ( const sptk::String value)
inlineoverridevirtual

Assignment operation

Reimplemented from sptk::Variant.

References VAR_STRING.

◆ operator=() [6/12]

Field & sptk::Field::operator= ( const uint8_t *  value)
inlineoverridevirtual

Assignment operation

Reimplemented from sptk::Variant.

◆ operator=() [7/12]

Field & sptk::Field::operator= ( const Variant C)
inline

Assignment operation

◆ operator=() [8/12]

Field & sptk::Field::operator= ( DateTime  value)
inlineoverridevirtual

Assignment operation

Reimplemented from sptk::Variant.

◆ operator=() [9/12]

Field & sptk::Field::operator= ( double  value)
inlineoverridevirtual

Assignment operation

Reimplemented from sptk::Variant.

◆ operator=() [10/12]

Field & sptk::Field::operator= ( Field &&  other)
defaultnoexcept

Move assignment operation

◆ operator=() [11/12]

Field & sptk::Field::operator= ( int32_t  value)
inlineoverridevirtual

Assignment operation

Reimplemented from sptk::Variant.

◆ operator=() [12/12]

Field & sptk::Field::operator= ( int64_t  value)
inlineoverridevirtual

Assignment operation

Reimplemented from sptk::Variant.

◆ view()

View & sptk::Field::view ( )
inline

Combination of field view attributes


The documentation for this class was generated from the following file:

Fri Oct 14 2022 09:58:42: SPTK 5.4.1