Beispiel #1
0
	static NArrayWrapper<NInt> GetValues(const NType & type)
	{
		NInt count;
		NCheck(NEnumGetValues(type.GetHandle(), NULL, &count));
		NArrayWrapper<NInt> values(count);
		NCheck(NEnumGetValues(type.GetHandle(), values.GetPtr(), &count));
		return values;
	}
Beispiel #2
0
NValue
n_to_string(NValue value) {
    NTypeRegistry* registry = n_type_registry_get_default();
    NType* type = n_type_registry_fetch_type(registry, n_typeof(value));

    /* FIXME: Should manage the error result on string constructor and what
       to do when type->to_string returns NULL */
    char* repr_bytes = type->to_string(type, value);
    NString* repr_string = n_string_wrap(repr_bytes, NULL);

    return n_wrap_pointer(repr_string);
}
Beispiel #3
0
	static bool TryParse(const NType & type, const NStringWrapper & value, const NStringWrapper & format, NInt32 * pValue)
	{
		NBool result;
		NCheck(NEnumTryParseN(type.GetHandle(), value.GetHandle(), format.GetHandle(), pValue, &result));
		return result != 0;
	}
Beispiel #4
0
	static NString ToString(const NType & type, NInt32 value, const NStringWrapper & format = NString())
	{
		HNString hValue;
		NCheck(NEnumToStringN(type.GetHandle(), value, format.GetHandle(), &hValue));
		return NString(hValue, true);
	}
	NStack(const NType & elementType, NInt capacity, NInt maxCapacity, NInt growthDelta, NSizeType alignment)
	{
		NCheck(Internal::NStackInitEx(this, 0, elementType.GetHandle(), capacity, maxCapacity, growthDelta, alignment));
	}
	NStack(const NType & elementType, NInt capacity)
	{
		NCheck(Internal::NStackInitWithCapacity(this, 0, elementType.GetHandle(), capacity));
	}
	NStack(const NType & elementType)
	{
		NCheck(Internal::NStackInit(this, 0, elementType.GetHandle()));
	}
	NInt CopyTo(const NType & valueType, void * pValues, NSizeType valuesSize, NInt valuesLength)
	{
		return NCheck(Internal::NStackCopyTo(this, valueType.GetHandle(), pValues, valuesSize, valuesLength));
	}
	bool Contains(const NType & valueType, const void * pValue, NSizeType valueSize)
	{
		NBool result;
		NCheck(Internal::NStackContains(this, valueType.GetHandle(), pValue, valueSize, &result));
		return result != 0;
	}
	void Set(NInt baseIndex, NInt index, const NType & valueType, NAttributes attributes, const void * pValue, NSizeType valueSize)
	{
		NCheck(NArrayCollectionSet(GetHandle(), baseIndex, index, valueType.GetHandle(), attributes, pValue, valueSize));
	}
	bool Contains(NInt baseIndex, const NType & valueType, NAttributes attributes, const void * pValue, NSizeType valueSize) const
	{
		NBool result;
		NCheck(NArrayCollectionContains(GetHandle(), baseIndex, valueType.GetHandle(), attributes, pValue, valueSize, &result));
		return result != 0;
	}
	NInt IndexOf(NInt baseIndex, const NType & valueType, NAttributes attributes, const void * pValue, NSizeType valueSize) const
	{
		NInt index;
		NCheck(NArrayCollectionIndexOf(GetHandle(), baseIndex, valueType.GetHandle(), attributes, pValue, valueSize, &index));
		return index;
	}
	void InsertRange(NInt baseIndex, NInt index, const NType & valueType, NAttributes attributes, const void * arValues, NSizeType valuesSize, NInt valueCount)
	{
		NCheck(NArrayCollectionInsertRange(GetHandle(), baseIndex, index, valueType.GetHandle(), attributes, arValues, valuesSize, valueCount));
	}
	NInt AddRange(NInt baseIndex, const NType & valueType, NAttributes attributes, const void * arValues, NSizeType valuesSize, NInt valueCount)
	{
		NInt index;
		NCheck(NArrayCollectionAddRange(GetHandle(), baseIndex, valueType.GetHandle(), attributes, arValues, valuesSize, valueCount, &index));
		return index;
	}
Beispiel #15
0
	static NInt32 Parse(const NType & type, const NStringWrapper & value, const NStringWrapper & format = NString())
	{
		NInt32 result;
		NCheck(NEnumParseN(type.GetHandle(), value.GetHandle(), format.GetHandle(), &result));
		return result;
	}
	void Push(const NType & valueType, const void * pValue, NSizeType valueSize)
	{
		NCheck(Internal::NStackPush(this, valueType.GetHandle(), pValue, valueSize));
	}
 void SetValue(const NObject & object, const NType & valueType, NAttributes attributes, const void * arValues, NSizeType valuesSize, NInt valuesLength, bool hasValue = true) const
 {
     NCheck(NPropertyInfoSetValue(GetHandle(), object.GetHandle(), valueType.GetHandle(), attributes, arValues, valuesSize, valuesLength, hasValue ? NTrue : NFalse));
 }