Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kValue.h
Go to the documentation of this file.
1 
10 #include <kApi/kApiDef.h> //--inclusion order controlled by kApiDef
11 
12 #ifndef K_API_VALUE_H
13 #define K_API_VALUE_H
14 
15 #include <kApi/kValue.x.h>
16 
50 kInlineFx(kBool) kValue_Equals(kType type, const void* value, const void* other)
51 {
52  return kValue_VTable(type)->VEquals(type, value, other);
53 }
54 
67 #define kValue_EqualsT(kType_type, TPtr_value, TPtr_other) \
68  xkValue_EqualsT(kType_type, TPtr_value, TPtr_other, sizeof(*TPtr_value), sizeof(*(TPtr_other)))
69 
78 kInlineFx(kSize) kValue_HashCode(kType type, const void* value)
79 {
80  return kValue_VTable(type)->VHashCode(type, value);
81 }
82 
94 #define kValue_HashCodeT(kType_type, TPtr_value) \
95  xkValue_HashCodeT(kType_type, TPtr_value, sizeof(*(TPtr_value)))
96 
108 kInlineFx(void) kValue_Import(kType type, void* value, const void* source)
109 {
110  if (kType_IsArrayValue(type))
111  {
112  kValue_VTable(type)->VImport(type, value, source);
113  }
114  else
115  {
116  //optimization; skip virtual call for non array-value types
117  kItemCopy(value, source, kType_Size(type));
118  }
119 }
120 
136 kFx(kBool) kValue_VEquals(kType type, const void* value, const void* other);
137 
153 kFx(kSize) kValue_VHashCode(kType type, const void* value);
154 
169 kInlineFx(void) kValue_VImport(kType type, void* value, const void* source)
170 {
171  kItemCopy(value, source, kType_Size(type));
172 }
173 
174 
175 #endif
kBool kValue_VEquals(kType type, const void *value, const void *other)
Protected virtual method that compares two values for equality.
kBool kType_IsArrayValue(kType type)
Reports whether the type is an 'array-value' type (e.g., kText32)
Definition: kType.h:185
kSize kValue_VHashCode(kType type, const void *value)
Protected virtual method that calculates a hash code representing the value instance.
Represents an unsigned integer that can store a pointer address.
void kValue_Import(kType type, void *value, const void *source)
Imports the content of another value into this value.
Definition: kValue.h:108
kBool kValue_Equals(kType type, const void *value, const void *other)
Determines whether a value is equal to another value.
Definition: kValue.h:50
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
kSize kValue_HashCode(kType type, const void *value)
Gets a hash code representing the state of this value.
Definition: kValue.h:78
void kItemCopy(void *dest, const void *src, kSize size)
Performs a small copy with minimal overhead.
Definition: kApiDef.h:2205
Core Zen type declarations.
void kValue_VImport(kType type, void *value, const void *source)
Protected virtual method that imports data from an external source into an array-value type...
Definition: kValue.h:169
kSize kType_Size(kType type)
Gets the external size of a type.
Definition: kType.h:304
Represents metadata about a type (class, interface, or value).
Represents a boolean value.