NCBI C++ ToolKit
Public Member Functions | Protected Member Functions | List of all members
CBDB_FieldLString Class Reference

Search Toolkit Book for CBDB_FieldLString

Length prefised string field type. More...

#include <db/bdb/bdb_types.hpp>

+ Inheritance diagram for CBDB_FieldLString:
+ Collaboration diagram for CBDB_FieldLString:

Public Member Functions

 CBDB_FieldLString ()
 
virtual CBDB_FieldConstruct (size_t buf_size) const
 Virtual constructor - class factory for BDB fields. More...
 
 operator string () const
 
CBDB_FieldLStringoperator= (const CBDB_FieldLString &str)
 
CBDB_FieldLStringoperator= (const char *str)
 
CBDB_FieldLStringoperator= (const string &str)
 
void Set (const char *str, EOverflowAction if_overflow=eThrowOnOverflow)
 
void Set (const char *str, size_t size, EOverflowAction if_overflow=eThrowOnOverflow)
 
string Get () const
 
virtual string GetString () const
 
bool IsEmpty () const
 
bool IsBlank () const
 
virtual int Compare (const void *p1, const void *p2, bool) const
 Comparison function. More...
 
virtual size_t GetDataLength (const void *buf) const
 Return current effective size of the buffer. More...
 
virtual void SetMinVal ()
 Set minimal possible value for the field type. More...
 
virtual void SetMaxVal ()
 Set maximum possible value for the field type. More...
 
virtual void SetString (const char *)
 
virtual void SetStdString (const string &str)
 
virtual BDB_CompareFunction GetCompareFunction (bool) const
 Return address to the type specific comparison function By default it's universal BDB_Compare. More...
 
virtual void ToString (string &str) const
 
- Public Member Functions inherited from CBDB_Field
 CBDB_Field (ELengthType length_type=eFixedLength)
 
virtual ~CBDB_Field ()
 
bool IsNullable () const
 Return TRUE if field can be NULL. More...
 
void SetNull ()
 Assign field value to NULL. More...
 
bool IsNull () const
 Return TRUE if field is NULL. More...
 
const stringGetName () const
 Return symbolic name for the field. More...
 
const void * GetBuffer () const
 Get pointer to the data. NULL if not yet attached. More...
 
void * GetBuffer ()
 Get pointer to the data. NULL if not yet attached. More...
 
size_t GetBufferSize () const
 Return maximum possible buffer length. More...
 
size_t GetLength () const
 Get length of the actual data. More...
 
- Public Member Functions inherited from IBDB_Field
virtual ~IBDB_Field ()
 
- Public Member Functions inherited from IBDB_FieldConvert
virtual ~IBDB_FieldConvert ()
 
virtual void SetInt (int)
 
virtual void SetUint (unsigned)
 
virtual int GetInt () const
 
virtual unsigned GetUint () const
 
virtual void SetFloat (float)
 
virtual void SetDouble (double)
 

Protected Member Functions

const unsigned char * GetLString (const unsigned char *str, bool check_legacy, int *str_len) const
 
virtual size_t GetExtraDataLength ()
 Hook for defining extra data length. More...
 
- Protected Member Functions inherited from CBDB_FieldStringBase
 CBDB_FieldStringBase ()
 
- Protected Member Functions inherited from CBDB_Field
int CompareWith (const CBDB_Field &field) const
 Field comparison function. More...
 
void CopyFrom (const CBDB_Field &src)
 Copies field value from another field. More...
 
bool IsVariableLength () const
 Return TRUE if it is a variable length variable (like string) More...
 
bool IsBufferAttached () const
 Return TRUE if external buffer has already been attached. More...
 
bool IsSameType (const CBDB_Field &field) const
 RTTI based check if fld is of the same type. More...
 
bool IsByteSwapped () const
 Return TRUE if field belongs to a file with an alternative byte order. More...
 
void SetNullable ()
 Mark field as "NULL" capable. More...
 
void SetNotNull ()
 Set "is NULL" flag to FALSE. More...
 
void SetName (const char *name)
 Set symbolic name for the field. More...
 
void SetBufferIdx (unsigned int idx)
 Set field position in the buffer manager. More...
 
void * Unpack ()
 Unpack the buffer which contains this field (using CBDB_BufferManager). More...
 
void SetBuffer (void *buf, size_t buf_size=0)
 Set external buffer pointer and length. More...
 
void SetBufferSize (size_t size)
 Set the buffer size. More...
 
void SetDataSize (size_t size)
 Set data size, taking into account possible extra data for some fields. More...
 
void SetBufferManager (CBDB_BufferManager *owner)
 Set CBDB_BufferManager – which works as a memory manager for BDB fields. More...
 
void CopyFrom (const void *src_buf)
 Copy buffer value from the external source. More...
 

Additional Inherited Members

- Public Types inherited from CBDB_FieldStringBase
enum  EOverflowAction { eThrowOnOverflow, eTruncateOnOverflow, eTruncateOnOverflowLogError }
 
- Public Types inherited from CBDB_Field
enum  ELengthType { eFixedLength, eVariableLength }
 Length based classificator for fields (fixed-variable) More...
 
- Protected Attributes inherited from CBDB_Field
CBDB_BufferManagerm_BufferManager
 
struct {
   unsigned   VariableLength: 1
 
   unsigned   Attached: 1
 
   unsigned   Nullable: 1
 
m_Flags
 

Detailed Description

Length prefised string field type.

Definition at line 1708 of file bdb_types.hpp.

Constructor & Destructor Documentation

CBDB_FieldLString::CBDB_FieldLString ( )

Definition at line 853 of file bdb_types.cpp.

References CBDB_Field::SetBufferSize().

Referenced by Construct().

Member Function Documentation

int CBDB_FieldLString::Compare ( const void *  p1,
const void *  p2,
bool  byte_swapped 
) const
virtual

Comparison function.

p1 and p2 are void pointers on field buffers. Positive if p1>p2, zero if p1==p2, negative if p1<p2. NOTE: both buffers can be unaligned. byte_swapped TRUE indicates that buffers values are in a different byte order architecture

Implements IBDB_Field.

Definition at line 985 of file bdb_types.cpp.

References _ASSERT, GetLString(), CBDB_BufferManager::IsLegacyStrings(), CBDB_Field::m_BufferManager, min(), and r().

CBDB_Field * CBDB_FieldLString::Construct ( size_t  buf_size) const
virtual

Virtual constructor - class factory for BDB fields.

Default (zero) value of 'buf-len' uses GetBufferSize(). For fixed length fields this buf_size parameter has no effect

Implements CBDB_Field.

Definition at line 859 of file bdb_types.cpp.

References CBDB_FieldLString(), CBDB_Field::GetBufferSize(), and CBDB_Field::SetBufferSize().

string CBDB_FieldLString::Get ( void  ) const
virtual BDB_CompareFunction CBDB_FieldLString::GetCompareFunction ( bool  byte_swapped) const
inlinevirtual

Return address to the type specific comparison function By default it's universal BDB_Compare.

Reimplemented from CBDB_Field.

Definition at line 1747 of file bdb_types.hpp.

References BDB_LStringCompare().

size_t CBDB_FieldLString::GetDataLength ( const void *  buf) const
virtual

Return current effective size of the buffer.

Implements IBDB_Field.

Definition at line 1065 of file bdb_types.cpp.

References GetLString(), CBDB_BufferManager::IsLegacyStrings(), and CBDB_Field::m_BufferManager.

Referenced by operator=().

size_t CBDB_FieldLString::GetExtraDataLength ( )
protectedvirtual

Hook for defining extra data length.

Reimplemented from CBDB_Field.

Definition at line 884 of file bdb_types.cpp.

const unsigned char * CBDB_FieldLString::GetLString ( const unsigned char *  str,
bool  check_legacy,
int str_len 
) const
protected
virtual string CBDB_FieldLString::GetString ( void  ) const
inlinevirtual
bool CBDB_FieldLString::IsBlank ( ) const
bool CBDB_FieldLString::IsEmpty ( void  ) const
CBDB_FieldLString::operator string ( ) const
inline

Definition at line 1717 of file bdb_types.hpp.

References GetString().

CBDB_FieldLString & CBDB_FieldLString::operator= ( const CBDB_FieldLString str)
CBDB_FieldLString & CBDB_FieldLString::operator= ( const char *  str)

Definition at line 1080 of file bdb_types.cpp.

References CBDB_FieldStringBase::eThrowOnOverflow, and Set().

CBDB_FieldLString & CBDB_FieldLString::operator= ( const string str)

Definition at line 1086 of file bdb_types.cpp.

References SetStdString().

void CBDB_FieldLString::Set ( const char *  str,
EOverflowAction  if_overflow = eThrowOnOverflow 
)

Definition at line 971 of file bdb_types.cpp.

References kEmptyCStr.

Referenced by operator=(), SetMinVal(), and SetStdString().

void CBDB_FieldLString::Set ( const char *  str,
size_t  size,
EOverflowAction  if_overflow = eThrowOnOverflow 
)
void CBDB_FieldLString::SetMaxVal ( )
virtual

Set maximum possible value for the field type.

Implements IBDB_Field.

Definition at line 1017 of file bdb_types.cpp.

References buf, CBDB_Field::GetBufferSize(), CBDB_Field::SetNotNull(), and CBDB_Field::Unpack().

void CBDB_FieldLString::SetMinVal ( )
virtual

Set minimal possible value for the field type.

Implements IBDB_Field.

Definition at line 1011 of file bdb_types.cpp.

References CBDB_FieldStringBase::eTruncateOnOverflow, and Set().

void CBDB_FieldLString::SetStdString ( const string str)
virtual
void CBDB_FieldLString::SetString ( const char *  str)
virtual

Reimplemented from IBDB_FieldConvert.

Definition at line 979 of file bdb_types.cpp.

References operator=().

void CBDB_FieldLString::ToString ( string str) const
virtual

The documentation for this class was generated from the following files:
Modified on Thu Jul 02 15:48:09 2015 by modify_doxy.py rev. 426318