Exemple #1
0
cas::Value Object::GetValue()
{
	assert(!is_clas);
	cas::Value v;
	v.type = global->GetType();
	if(global->ptr)
	{
		switch(global->vartype.type)
		{
		case V_BOOL:
			v.bool_value = *(bool*)global->ptr;
			break;
		case V_CHAR:
			v.char_value = *(char*)global->ptr;
			break;
		case V_INT:
			v.int_value = *(int*)global->ptr;
			break;
		case V_FLOAT:
			v.float_value = *(float*)global->ptr;
			break;
		default:
			{
				auto type = global->module_proxy->GetType(global->vartype.type);
				assert(type->IsEnum());
				v.int_value = *(int*)global->ptr;
			}
			break;
		}
	}
	else
		context->GetGlobalValue(global->index, v);
	return v;
}
//---------------------------------------------------------------------------
UEProperty::Info UEByteProperty::GetInfo() const
{
	if (IsEnum())
	{
		return Info::Create(PropertyType::Primitive, sizeof(uint8_t), false, "TEnumAsByte<" + MakeUniqueCppName(GetEnum()) + ">");
	}
	return Info::Create(PropertyType::Primitive, sizeof(uint8_t), false, "unsigned char");
}
Exemple #3
0
tinyxml2::XMLElement* FieldBinding::GenerateWsdl(tinyxml2::XMLDocument* doc) const
{
  tinyxml2::XMLElement* el = doc->NewElement("xs:element");
  el->SetAttribute("name", m_name.c_str());

  if (IsEnum())
  {
    tinyxml2::XMLElement* restriction = doc->NewElement("xs:restriction");
    restriction->SetAttribute("base", "xs:string");

    for (size_t x = 0; x < m_enumValues.size(); ++x)
    {
      tinyxml2::XMLElement* enumeration = doc->NewElement("xs:enumeration");
      enumeration->SetAttribute("value", m_enumValues[x].c_str());
      restriction->LinkEndChild(enumeration);
    }
    el->LinkEndChild(restriction);
  }
  else
  {
    if (IsOptional())
    {
      el->SetAttribute("minOccurs", "0");
    }

    if (IsRepeated())
    {
      el->SetAttribute("maxOccurs", "unbounded");
    }

    if (IsClass())
    {
      el->SetAttribute("type", (string("bntypes:") + m_type).c_str());
    }
    else
    {
      el->SetAttribute("type", (string("xs:") + m_type).c_str());
    }
  }

	return el;
}
JBoolean
CBCClass::ViewDefinition
	(
	const JCharacter*	fnName,
	const JBoolean		caseSensitive,
	const JBoolean		reportNotFound
	)
	const
{
	JBoolean found = kJFalse;

	JString headerName;
	if (IsEnum())
		{
		found = ViewDeclaration(fnName, caseSensitive, reportNotFound);
		}
	else if (!Implements(fnName, caseSensitive))
		{
		found = ViewInheritedDefinition(fnName, caseSensitive, reportNotFound);
		if (!found && reportNotFound)
			{
			JString msg = "Unable to find any definition for \"";
			msg += fnName;
			msg += "\".";
			(JGetUserNotification())->ReportError(msg);
			}
		}
	else if (GetFileName(&headerName))
		{
		// search for class::fn

		const JCharacter* nsOp = "[[:space:]]*::[[:space:]]*";

		JString searchStr = GetFullName();

		JIndex i=1;
		while (searchStr.LocateNextSubstring("::", &i))
			{
			searchStr.ReplaceSubstring(i,i+1, nsOp);
			i += strlen(nsOp);
			}

		searchStr += nsOp;
		searchStr += fnName;
		found = FindDefinition(headerName, searchStr, caseSensitive);

		if (!found)
			{
			// "::" insures that we find the source instead of a call to the function.
			// We can't use "class::" because this doesn't work for templates.

			searchStr = "::[[:space:]]*";
			searchStr += fnName;
			found = FindDefinition(headerName, searchStr, caseSensitive);
			}

		if (!found)
			{
			CBDocumentManager* docMgr = CBGetDocumentManager();

			// look for it in the header file (pure virtual or inline in class defn)

			JIndex lineIndex;
			if (docMgr->SearchFile(headerName, fnName, caseSensitive, &lineIndex))
				{
				docMgr->OpenTextDocument(headerName, lineIndex);
				found = kJTrue;
				}

			// we couldn't find it anywhere

			else if (reportNotFound)
				{
				JString msg = "Unable to find the definition for \"";
				msg += fnName;
				msg += "\".";
				(JGetUserNotification())->ReportError(msg);
				}
			}
		}
	else if (reportNotFound)
		{
		JString msg = GetFullName();
		msg.PrependCharacter('"');
		msg += "\" is a ghost class, so no information is available for it.";
		(JGetUserNotification())->ReportError(msg);
		}

	return found;
}