本文整理汇总了C++中IsArray函数的典型用法代码示例。如果您正苦于以下问题:C++ IsArray函数的具体用法?C++ IsArray怎么用?C++ IsArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsArray函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: assert
JSONValue JSONValue::CreateChild(JSONValueType valueType)
{
assert(IsArray());
if (!IsArray())
return JSONValue::EMPTY;
Value value(ToRapidJsonType(valueType));
value_->PushBack(value, file_->GetDocument()->GetAllocator());
return GetChild(GetSize() - 1, valueType);
}
开发者ID:Boshin,项目名称:Urho3D,代码行数:11,代码来源:JSONValue.cpp
示例2: WithoutPointerCasts
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int AggregateCopyPropagation::ExtractCopySetInfo(CallInstr* instr, Operand*& destOp) {
DebugValidator::IsNotNull(instr);
// Check if we have a call to 'copyMemory' or
// 'setMemory' that targets records or arrays.
if(auto intrinsic = instr->GetIntrinsic()) {
bool valid = false;
bool isCopy;
destOp = WithoutPointerCasts(CopyMemoryIntr::GetDestination(instr));
if(intrinsic->Is<CopyMemoryIntr>()) {
// The copy is valid only if the whole object
// is copied using a constant size argument.
auto destType = destOp->GetType()->As<PointerType>()->PointeeType();
if(destType->IsRecord() || destType->IsArray()) {
if(auto intConst = CopyMemoryIntr::GetLength(instr)->As<IntConstant>()) {
int size = TI::GetSize(destType, GetTarget());
valid = intConst->Value() == size;
}
}
isCopy = true;
}
else if(intrinsic->Is<SetMemoryIntr>()) {
// The copy is valid only if the whole object
// is set using a constant size argument and a constant value.
auto destType = destOp->GetType()->As<PointerType>()->PointeeType();
if(destType->IsRecord() || destType->IsArray()) {
if(auto intConst = SetMemoryIntr::GetLength(instr)->As<IntConstant>()) {
int size = TI::GetSize(destType, GetTarget());
// Check that the value that is set is a constant.
valid = (intConst->Value() == size) &&
(SetMemoryIntr::GetSource(instr)->IsIntConstant());
}
}
isCopy = false;
}
if(valid) {
return AddInfo(instr, isCopy);
}
}
return -1;
}
开发者ID:lgratian,项目名称:compiler,代码行数:50,代码来源:AggregateCopyPropagation.cpp
示例3: TITANIUM_FUNCTION
TITANIUM_FUNCTION(ListView, replaceSectionAt)
{
const auto js_context = this_object.get_context();
if (arguments.size() >= 2) {
JSObject animation = js_context.CreateObject();
std::vector<std::shared_ptr<ListSection>> sections;
const auto _0 = arguments.at(0);
TITANIUM_ASSERT(_0.IsNumber());
const auto sectionIndex = static_cast<uint32_t>(_0);
const auto _1 = arguments.at(1);
TITANIUM_ASSERT(_1.IsObject());
const auto js_sections = static_cast<JSObject>(_1);
if (js_sections.IsArray()) {
sections = static_cast<JSArray>(js_sections).GetPrivateItems<ListSection>();
} else {
sections.push_back(js_sections.GetPrivate<ListSection>());
}
if (arguments.size() >= 3) {
const auto _2 = arguments.at(2);
if (_2.IsObject()) {
animation = listviewAnimationProperties_ctor__.CallAsConstructor({_2});
}
}
replaceSectionAt(sectionIndex, sections, animation.GetPrivate<ListViewAnimationProperties>());
}
return this_object.get_context().CreateUndefined();
}
开发者ID:appcelerator-forks,项目名称:appcelerator.titanium_mobile_windows,代码行数:32,代码来源:ListView.cpp
示例4: flags
Qt::ItemFlags JSON_Model::flags(QModelIndex const& index) const
{
// std::lock_guard<std::recursive_mutex> sm(mTreeMutex);
if (!index.isValid())
{
return 0;
}
uint32_t default_flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
auto* ti = (Tree_Item*)index.internalPointer();
if (!ti || !ti->m_json)
{
return Qt::ItemFlags(default_flags);
}
auto json = ti->m_json;
if (json->IsObject() || json->IsArray())
{
return Qt::ItemFlags(default_flags);
}
return Qt::ItemFlags((index.column() == 0) ? default_flags : default_flags | Qt::ItemIsEditable);
}
开发者ID:ggggamer,项目名称:silkopter,代码行数:26,代码来源:JSON_Model.cpp
示例5: TypeException
const Array &Node::AsArray() const
{
if (IsArray())
return static_cast<const Array&>(*this);
else
throw TypeException();
}
开发者ID:mqudsi,项目名称:Jzon,代码行数:7,代码来源:Jzon.cpp
示例6: GetStrItemIndexOfSafeArray
int WindDataParser::GetStrItemIndexOfSafeArray(const VARIANT& safeArray, const wstring& itemNameStr)
{
if(!IsArray(safeArray))
{
return -1;
}
int length = GetCountOfSafeArray(safeArray);
HRESULT hr ;
BSTR *pbItems;
hr = SafeArrayAccessData(safeArray.parray, (void HUGEP**)&pbItems);
if (FAILED(hr))
{
return -1;
}
int nRetIndex = -1;
for(int index = 0; index < length; index++)
{
if (0 == itemNameStr.compare(pbItems[index]))
{
nRetIndex = index;
break;
}
}
SafeArrayUnaccessData(safeArray.parray);
return nRetIndex;
}
开发者ID:Pluzhou,项目名称:Official,代码行数:30,代码来源:WindDataParser.cpp
示例7: GetStrItemByIndex
wstring WindDataParser::GetStrItemByIndex(const VARIANT& safeArray, int index)
{
if(!IsArray(safeArray))
{
return L"";
}
if (VT_BSTR != (safeArray.vt & VT_BSTR_BLOB))
{
return L"";
}
HRESULT hr ;
BSTR *pbItems;
if (index >= GetCountOfSafeArray(safeArray))
{
return L"";
}
hr = SafeArrayAccessData(safeArray.parray, (void HUGEP**)&pbItems);
if (FAILED(hr))
{
return L"";
}
wstring itemStr = pbItems[index];
SafeArrayUnaccessData(safeArray.parray);
return itemStr;
}
开发者ID:Pluzhou,项目名称:Official,代码行数:32,代码来源:WindDataParser.cpp
示例8: GetDoubleItemIndexOfSafeArray
int WindDataParser::GetDoubleItemIndexOfSafeArray(const VARIANT& safeArray, DOUBLE dbl)
{
if(!IsArray(safeArray))
{
return -1;
}
int length = GetCountOfSafeArray(safeArray);
HRESULT hr;
DOUBLE *pbItems;
hr = SafeArrayAccessData(safeArray.parray, (void HUGEP**)&pbItems);
if (FAILED(hr))
{
return -1;
}
int nRetIndex = -1;
for(int index = 0; index < length; index++)
{
if (dbl == pbItems[index])
{
nRetIndex = index;
break;
}
}
SafeArrayUnaccessData(safeArray.parray);
return nRetIndex;
}
开发者ID:Pluzhou,项目名称:Official,代码行数:30,代码来源:WindDataParser.cpp
示例9: strdup
template<typename VALUE_T>uint32_t
Document_t<VALUE_T>::Locate(uint32_t pos, const char *path) const
{
char *cur, *next, *_path = strdup(path);
for (cur = _path; cur != NULL; cur = next) {
if ((next = strchr(cur, '.')) != NULL) *next++ = 0;
if (strlen(cur) == strspn(cur, "0123456789")) {
if (!IsArray(pos)) {
pos = UINT32_MAX; goto quit0;
}
uint32_t idx = atol(cur);
if (idx >= GetArraySpace(pos)) {
pos = UINT32_MAX; goto quit0;
}
pos = GetArray(pos, idx);
} else {
if (!IsObject(pos)) {
pos = UINT32_MAX; goto quit0;
}
if ((pos = ObjectSearch(pos, cur)) == UINT32_MAX) {
pos = UINT32_MAX; goto quit0;
}
}
}
quit0:
free(_path);
return pos;
}
开发者ID:charlesw1234,项目名称:learning,代码行数:28,代码来源:freeze.hpp
示例10: pick
// fix arrays -- i.e. replace a tuple containing ALL unnamed elements
// with the corresponding array
// ( gdb evaluator array data is returned as tuple with {} instead []=
void MIValue::FixArrays(void)
{
bool named = false;
if(IsTuple())
{
for(int iVal = 0; iVal < tuple.GetCount(); iVal++)
if(tuple.GetKey(iVal) != "<UNNAMED>")
{
named = true;
break;
}
if(!named)
{
array.Clear();
for(int iVal = 0; iVal < tuple.GetCount(); iVal++)
array.Add() = pick(tuple[iVal]);
tuple.Clear();
type = MIArray;
}
}
if(IsTuple() || IsArray())
for(int i = 0; i < GetCount(); i++)
Get(i).FixArrays();
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:28,代码来源:MIValue.cpp
示例11: GetType
Type GetType(JSValueRef value)
{
if (JSValueIsNull(g_ctx, value))
return VTYPE_NULL;
if (JSValueIsBoolean(g_ctx, value))
return VTYPE_BOOL;
if (JSValueIsNumber(g_ctx, value))
return VTYPE_DOUBLE;
if (JSValueIsString(g_ctx, value))
return VTYPE_STRING;
if (JSValueIsObject(g_ctx, value))
{
JSObjectRef obj = JSValueToObject(g_ctx, value, NULL);
if (JSObjectIsFunction(g_ctx, obj))
return VTYPE_FUNCTION;
if (IsArray(obj))
return VTYPE_LIST;
return VTYPE_DICTIONARY;
}
return VTYPE_INVALID;
}
开发者ID:vnmc,项目名称:zephyros,代码行数:25,代码来源:jsbridge_webview.cpp
示例12: assert
void CVisProp::SetObjFromPv(const void *pvObj,
const CVisDimIndex& refdimindex)
{
assert(IsArray());
PropTypeInfo().AssignObjToObj(pvObj,
PRefCntArray()->PvObj(refdimindex));
}
开发者ID:bigdig,项目名称:Portrait,代码行数:7,代码来源:VisProp.cpp
示例13: SetObjReferenceFromPv
void CVisProp::SetObjReferenceFromPv(void *pvObj, bool fShared)
{
if (IsValid() && IsArray())
ReleaseObj();
assert(!IsValid() || !FPointerToObject() || PvRefCntObj() != 0);
if ((IsValid()) && (IsShared() == fShared) && (IsObjReference()))
{
((CVisRefCntObj<void *> *) PvRefCntObj())->Obj() = pvObj;
}
else
{
ReleaseObj();
SetFShared(fShared);
SetFPointerToObject(fShared);
if (fShared)
{
SetPvRefCntObj(new CVisRefCntObj<void *>(pvObj));
}
else
{
*((void * *) (void *) &m_llData) = pvObj;
}
SetFObjReference(true);
SetFInitialized(true);
}
}
开发者ID:bigdig,项目名称:Portrait,代码行数:30,代码来源:VisProp.cpp
示例14: if
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VariableAnalysis::MarkAddressTaken(Instruction* instr) {
if(auto loadInstr = instr->As<LoadInstr>()) {
// Volatile loads should not be eliminated.
if(loadInstr->IsVolatile()) {
if(auto variableRef = loadInstr->SourceOp()->As<VariableReference>()) {
auto localVar = variableRef->GetVariable();
if(localVar == nullptr) {
return;
}
localVar->SetIsAddresTaken(true);
}
}
return; // We're done with this instruction.
}
else if(auto storeInstr = instr->As<StoreInstr>()) {
// Volatile stores should not be eliminated.
if(storeInstr->IsVolatile()) {
if(auto variableRef = storeInstr->DestinationOp()->As<VariableReference>()) {
auto localVar = variableRef->GetVariable();
if(localVar == nullptr) {
return;
}
localVar->SetIsAddresTaken(true);
}
}
// If the stored operand is a local variable we can't eliminate it.
if(storeInstr->SourceOp()->IsLocalVariableRef()) {
auto variableRef = storeInstr->SourceOp()->As<VariableReference>();
variableRef->GetVariable()->SetIsAddresTaken(true);
}
return; // We're done with this instruction.
}
// Any other instruction that has a variable reference as it's operand
// is considered to take it's address.
for(int i = 0; i < instr->SourceOpCount(); i++) {
if(auto variableRef = instr->GetSourceOp(i)->As<VariableReference>()) {
auto localVar = variableRef->GetVariable();
if(localVar == nullptr) {
continue;
}
// We don't set the flag for pointers, arrays and records because
// we have a separate step that takes care of this.
if((localVar->IsPointer() ||
localVar->IsRecord() ||
localVar->IsArray()) == false) {
localVar->SetIsAddresTaken(true);
}
}
}
}
开发者ID:lgratian,项目名称:compiler,代码行数:61,代码来源:VariableAnalysis.cpp
示例15: TITANIUM_FUNCTION
TITANIUM_FUNCTION(MusicPlayer, setQueue)
{
ENSURE_OBJECT_AT_INDEX(js_queue, 0);
std::vector<std::shared_ptr<Item>> queues;
const auto queue = js_queue.GetPrivate<Item>();
if (queue != nullptr) {
queues.push_back(queue);
} else if (js_queue.IsArray()) {
const auto js_array = static_cast<std::vector<JSValue>>(static_cast<JSArray>(js_queue));
for (const auto v : js_array) {
queues.push_back(static_cast<JSObject>(v).GetPrivate<Item>());
}
} else if (js_queue.HasProperty("items")) {
// PlayerQueue
const auto js_playerQueue = static_cast<JSObject>(js_queue.GetProperty("items"));
if (js_playerQueue.IsArray()) {
const auto js_array = static_cast<std::vector<JSValue>>(static_cast<JSArray>(js_playerQueue));
for (const auto v : js_array) {
queues.push_back(static_cast<JSObject>(v).GetPrivate<Item>());
}
}
}
setQueue(queues);
return get_context().CreateUndefined();
}
开发者ID:appcelerator-forks,项目名称:appcelerator.titanium_mobile_windows,代码行数:30,代码来源:MusicPlayer.cpp
示例16: size
size_t Json::size() const {
if (IsNull()) return 0;
if (IsObject()) return object().size();
if (IsArray()) return array().size();
if (IsString()) return string().size();
return 1;
}
开发者ID:ospace,项目名称:jsonlite_cpp,代码行数:7,代码来源:jsonlite.cpp
示例17: GetSize
unsigned JSONValue::GetSize() const
{
if (IsArray())
return (unsigned)value_->Size();
else
return 0;
}
开发者ID:Boshin,项目名称:Urho3D,代码行数:7,代码来源:JSONValue.cpp
示例18: _Check
void _Check(const String& name, CIMConstProperty& p, T* tag)
{
if (p.getName() == name)
{
if (IsArray(tag) != p.isArray() || GetType(tag) != p.getType())
throw CIMException(CIM_ERR_TYPE_MISMATCH, name);
}
}
开发者ID:xenserver,项目名称:openpegasus,代码行数:8,代码来源:CIMError.cpp
示例19: GetMatrix
CFX_Matrix CPDF_Array::GetMatrix() {
CFX_Matrix matrix;
if (!IsArray() || m_Objects.size() != 6)
return matrix;
matrix.Set(GetNumberAt(0), GetNumberAt(1), GetNumberAt(2), GetNumberAt(3),
GetNumberAt(4), GetNumberAt(5));
return matrix;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:9,代码来源:cpdf_array.cpp
示例20: ASSERT
//------------------------------------------------------------------------------
void ReflectedPropertyStruct::ResizeArrayOfStruct( void * object, size_t newSize ) const
{
// sanity checks
ASSERT( IsArray() );
ASSERT( GetType() == PT_STRUCT );
const ReflectionInfo * structRI = m_StructReflectionInfo;
void * arrayBase = (void *)( (size_t)object + m_Offset );
structRI->SetArraySize( arrayBase, newSize );
}
开发者ID:dummyunit,项目名称:fastbuild,代码行数:11,代码来源:ReflectedProperty.cpp
注:本文中的IsArray函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论