Qore Programming Language Reference Manual  1.10.0
Pseudo_QC_Binary.dox.h
1 
3 namespace Qore {
5 /***/
6 class <binary> : public <value> {
7 
8 public:
10 
22 bool empty();
23 
24 public:
26 
51 int find(data bin, softint byte_pos = 0);
52 
53 public:
55 
81 int rfind(data bin, softint byte_pos = -1);
82 
83 public:
85 
97 int size();
98 
99 public:
101 
110 bool sizep();
111 
112 public:
114 
130 list<binary> split(data sep);
131 
132 public:
134 
153 binary substr(softint start);
154 
155 public:
157 
177 binary substr(softint start, softint len);
178 
179 public:
181 
201 string toBase64(softint maxlinelen = -1);
202 
203 public:
205 
221 string toHex();
222 
223 public:
225 
249 string toMD5();
250 
251 public:
253 
275 string toSHA1();
276 
277 public:
279 
305 string toSHA224();
306 
307 public:
309 
335 string toSHA256();
336 
337 public:
339 
365 string toSHA384();
366 
367 public:
369 
395 string toSHA512();
396 
397 public:
399 
413 string toString(*string encoding);
414 
415 public:
417 
431 int typeCode();
432 
433 public:
435 
451 bool val();
452 };
453 }
Methods in this pseudo-class can be executed on binary values.
Definition: Pseudo_QC_Binary.dox.h:6
string toString(*string encoding)
Returns a string created from the binary data, taking an optional second argument giving the string e...
int typeCode()
Returns Qore::NT_BINARY.
int size()
Returns the number of bytes in the binary object.
string toSHA1()
Returns the SHA1 message digest of the binary data as a hex string.
string toSHA256()
Returns the SHA-256 message digest (a variant of SHA-2) of the binary data as a hex string.
string toSHA224()
Returns the SHA-224 message digest (a variant of SHA-2) of the binary data as a hex string.
int find(data bin, softint byte_pos=0)
Retrieves the byte position of a sequence of bytes within a binary object.
bool empty()
Returns True if the binary object is empty (size = 0), False if not.
binary substr(softint start)
Returns a portion of the binary data starting from an integer offset.
int rfind(data bin, softint byte_pos=-1)
Retrieves the byte position of a sequence of bytes within a binary object searching from the end of t...
list< binary > split(data sep)
Returns a list of binary objects representing each component of the binary object separated by the by...
bool val()
Returns False if the binary object is empty (size = 0), True if not.
string toSHA384()
Returns the SHA-384 message digest (a variant of SHA-2) of the binary data as a hex string.
binary substr(softint start, softint len)
Returns a portion of the binary data starting from an integer offset.
bool sizep()
Returns True since binary objects can return a non-zero size.
string toMD5()
Returns the MD5 message digest of the binary data as a hex string.
string toBase64(softint maxlinelen=-1)
Returns the base64-encoded representation of the binary object.
string toSHA512()
Returns the SHA-512 message digest (a variant of SHA-2) of the binary data as a hex string.
string toHex()
returns a string of hexadecimal digits corresponding to the contents of the binary object; hex charac...
Methods in this pseudo-class are available to be executed on any value type (even NOTHING); this is t...
Definition: Pseudo_QC_All.dox.h:6
binary binary()
Always returns an empty binary object (of zero length)
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3
er_type.html#a2c91f1e5dd6fcf3de0e54a217658e0cc">getFieldType (string field_name)  get the given field type if it exists, otherwise return NOTHING
  hash< DataTypeInfogetInfo ()  Returns a description of the type as a hash.
  hash< DataTypeInfogetInputInfo ()  Returns a description of the type as an input type. More...
  abstract string getName ()  Returns the type name.
  *hash< auto > getOptions ()  Returns options set on the type.
  auto getOptionValue (string opt)  Returns the value of the given option.
  AbstractDataProviderType getOrNothingType ()  Returns an "or nothing" type equivalent to the current type. More...
  abstract hash< string, bool > getReturnTypeHash ()  Returns a hash of types returned by this type; keys are type names.
  AbstractDataProviderType getSoftType ()  Returns a "soft" type equivalent to the current type. More...
  *hash< string, hash< DataProviderTypeOptionInfo > > getSupportedOptions ()  Returns supported options.
  auto getTag (string tag)  Returns the value of the given tag.
  *hash< auto > getTags ()  Returns tags set on the type.
  abstract *Type getValueType ()  Returns the base type for the type, if any.
  bool hasType ()  Returns True if the type is not a wildcard type.
  bool isAssignableFrom (AbstractDataProviderType t)  Returns True if this type can be assigned from values of the argument type.
  bool isAssignableFrom (Type t)  Returns True if this type can be assigned from values of the argument type.
  bool isList ()  Returns True if this type is a list.
  bool isMandatory ()  Returns True if the type must have a value.
  bool isOrNothingType ()  Returns True if the type also accepts NOTHING.
   setOption (string opt, auto value)  sets the given option on the type More...
   setOptions (hash< auto > options)  sets options on the type More...
 

Static Public Member Functions

static AbstractDataProviderType get (string typename, *hash< auto > options)
 Returns an appropriate object for the given type. More...
 
static AbstractDataProviderType get (Type type, *hash< auto > options, *hash< auto > tags)
 Returns an appropriate object for the given type.
 

Public Attributes

const DefaultDesc = "no description available"
 Default description.
 

Protected Member Functions

 setOptionIntern (string opt, auto value)
 sets the given option without any validation of the option
 

Protected Attributes

hash< auto > options
 type options
 
*hash< auto > tags
 type tags
 

Detailed Description

describes a data type

Member Function Documentation

◆ acceptsValue()

abstract auto DataProvider::AbstractDataProviderType::acceptsValue ( auto  value)
pure virtual

Returns the value if the value can be assigned to the type.

Parameters
valuethe value to assign to the type
Returns
the value to be assigned; can be converted by the type

Implemented in DataProvider::SoftListDataType, DataProvider::QoreStringDataTypeBase, DataProvider::QoreNumberDataTypeBase, DataProvider::QoreIntDataTypeBase, DataProvider::QoreFloatDataTypeBase, DataProvider::QoreDateDataTypeBase, DataProvider::QoreDataType, DataProvider::QoreBoolDataTypeBase, DataProvider::QoreBinaryDataTypeBase, DataProvider::ListDataType, DataProvider::HashDeclDataType, and DataProvider::HashDataType.

◆ constructor()

DataProvider::AbstractDataProviderType::constructor ( hash< auto >  options,
*hash< auto >  tags 
)

creates the type and sets options

Parameters
optionsa hash of options, if any options match supported options for this type, they are set
Exceptions
TYPE-OPTION-ERRORoption value has an invalid type

◆ get()

static AbstractDataProviderType DataProvider::AbstractDataProviderType::get ( string  typename,
*hash< auto >  options 
)
static

Returns an appropriate object for the given type.

Parameters
typenamethe name of the type; should be a valid Qore type string
optionstype options for the data type object

◆ getInputInfo()

hash<DataTypeInfo> DataProvider::AbstractDataProviderType::getInputInfo ( )

Returns a description of the type as an input type.

Returns
a description of the type as an input type; only the following keys are returned
  • name
  • types_returned
  • fields
  • base_type

◆ getOrNothingType()

AbstractDataProviderType DataProvider::AbstractDataProviderType::getOrNothingType ( )

Returns an "or nothing" type equivalent to the current type.

The base class method returns the same type; this method must be overridden in child classes to return a usable "or nothing" type

Returns
an "or nothing" type equivalent to the current type
Note
recursively updates fields to "or nothing" types as well

◆ getSoftType()

AbstractDataProviderType DataProvider::AbstractDataProviderType::getSoftType ( )

Returns a "soft" type equivalent to the current type.

The base class method returns the same type; this method must be overridden in child classes to return a usable "soft" type

Returns
a "soft" type equivalent to the current type

◆ setOption()

DataProvider::AbstractDataProviderType::setOption ( string  opt,
auto  value 
)

sets the given option on the type

Parameters
optthe option to set
valuethe value to set
Exceptions
TYPE-OPTION-ERRORinvalid option or invalid option type

◆ setOptions()

DataProvider::AbstractDataProviderType::setOptions ( hash< auto >  options)

sets options on the type

Parameters
optionsthe options to set; unsupported options are ignored
Exceptions
TYPE-OPTION-ERRORinvalid option type