当前位置: 首页>>代码示例>>C++>>正文


C++ SerializerElement::SetAttribute方法代码示例

本文整理汇总了C++中SerializerElement::SetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ SerializerElement::SetAttribute方法的具体用法?C++ SerializerElement::SetAttribute怎么用?C++ SerializerElement::SetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SerializerElement的用法示例。


在下文中一共展示了SerializerElement::SetAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SerializeTo

void ExternalEvents::SerializeTo(SerializerElement & element) const
{
    element.SetAttribute("name", name);
    element.SetAttribute("associatedLayout", associatedScene);
    element.SetAttribute("lastChangeTimeStamp", (int)lastChangeTimeStamp);
    gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));
}
开发者ID:HaoDrang,项目名称:GD,代码行数:7,代码来源:ExternalEvents.cpp

示例2: SendData

void AnalyticsSender::SendData(gd::String collection, SerializerElement & data)
{
    #if !defined(GD_NO_WX_GUI)
    //Check if we are allowed to send these data.
    bool sendInfo;
    wxConfigBase::Get()->Read("/Startup/SendInfo", &sendInfo, true);
    if (!sendInfo) return;

    data.SetAttribute("gdVersion", VersionWrapper::FullString());
    data.SetAttribute("os", gd::String(wxGetOsDescription()));
    data.SetAttribute("lang",
        gd::String(wxLocale::GetLanguageCanonicalName(LocaleManager::Get()->GetLanguage())));
    if (wxConfig::Get())
        data.SetAttribute("openingCount", wxConfig::Get()->ReadDouble("Startup/OpeningCount", 0));

    // Create request
    std::cout << "Sending analytics data..."; std::cout.flush();
    sf::Http Http;
    Http.setHost("http://api.keen.io");
    sf::Http::Request request;
    request.setMethod(sf::Http::Request::Post);
    request.setField("Content-Type", "application/json");
    request.setUri("/3.0/projects/"+projectId.ToLocale()+"/events/"+collection.ToLocale()+"?api_key="+writeKey.ToLocale());
    request.setBody(Serializer::ToJSON(data).ToSfString());

    // Send the request
    sf::Http::Response response = Http.sendRequest(request, sf::seconds(2));
    std::cout << "done (" << response.getStatus() << ")" << std::endl;
    #endif
}
开发者ID:HaoDrang,项目名称:GD,代码行数:30,代码来源:AnalyticsSender.cpp

示例3: SerializeTo

void Layer::SerializeTo(SerializerElement& element) const {
  element.SetAttribute("name", GetName());
  element.SetAttribute("visibility", GetVisibility());

  SerializerElement& camerasElement = element.AddChild("cameras");
  camerasElement.ConsiderAsArrayOf("camera");
  for (std::size_t c = 0; c < GetCameraCount(); ++c) {
    SerializerElement& cameraElement = camerasElement.AddChild("camera");
    cameraElement.SetAttribute("defaultSize", GetCamera(c).UseDefaultSize());
    cameraElement.SetAttribute("width", GetCamera(c).GetWidth());
    cameraElement.SetAttribute("height", GetCamera(c).GetHeight());

    cameraElement.SetAttribute("defaultViewport",
                               GetCamera(c).UseDefaultViewport());
    cameraElement.SetAttribute("viewportLeft", GetCamera(c).GetViewportX1());
    cameraElement.SetAttribute("viewportTop", GetCamera(c).GetViewportY1());
    cameraElement.SetAttribute("viewportRight", GetCamera(c).GetViewportX2());
    cameraElement.SetAttribute("viewportBottom", GetCamera(c).GetViewportY2());
  }

  SerializerElement& effectsElement = element.AddChild("effects");
  effectsElement.ConsiderAsArrayOf("effect");
  for (std::size_t i = 0; i < GetEffectsCount(); ++i) {
    SerializerElement& effectElement = effectsElement.AddChild("effect");
    GetEffect(i).SerializeTo(effectElement);
  }
}
开发者ID:4ian,项目名称:GD,代码行数:27,代码来源:Layer.cpp

示例4: SerializeTo

void ImageResource::SerializeTo(SerializerElement & element) const
{
    element.SetAttribute("alwaysLoaded", alwaysLoaded);
    element.SetAttribute("smoothed", smooth);
    element.SetAttribute("userAdded", IsUserAdded());
    element.SetAttribute("file", GetFile());
}
开发者ID:AntonioModer,项目名称:GD,代码行数:7,代码来源:ResourcesManager.cpp

示例5: Split

std::vector<Splitter::SplitElement> Splitter::Split(
    SerializerElement& element,
    const std::set<gd::String>& tags,
    gd::String path) {
  std::vector<Splitter::SplitElement> elements;
  for (auto& child : element.GetAllChildren()) {
    auto& childElement = child.second;
    gd::String ref = path + pathSeparator + child.first;

    if (tags.find(ref) != tags.end()) {
      gd::String refName = childElement->GetStringAttribute(nameAttribute);
      SplitElement splitElement = {ref, refName, *childElement};
      elements.push_back(splitElement);

      SerializerElement refElement;
      refElement.SetAttribute("referenceTo", ref);
      refElement.SetAttribute("name", refName);
      *childElement = refElement;
    } else {
      auto newElements = Split(*childElement, tags, ref);
      elements.insert(elements.end(), newElements.begin(), newElements.end());
    }
  }

  return elements;
}
开发者ID:Lizard-13,项目名称:GD,代码行数:26,代码来源:Splitter.cpp

示例6: SerializeTo

void ImageResource::SerializeTo(SerializerElement & element) const
{
    element.SetAttribute("alwaysLoaded", alwaysLoaded);
    element.SetAttribute("smoothed", smooth);
    element.SetAttribute("userAdded", IsUserAdded());
    element.SetAttribute("file", GetFile()); //Keep the resource path in the current locale (but save it in UTF8 for compatibility on other OSes)
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:7,代码来源:ResourcesManager.cpp

示例7: SerializeTo

void ExternalLayout::SerializeTo(SerializerElement & element) const
{
	element.SetAttribute("name", name);
	instances.SerializeTo(element.AddChild("instances"));
	#if !defined(GD_NO_WX_GUI)
	editionSettings.SerializeTo(element.AddChild("editionSettings"));
	element.SetAttribute("associatedLayout", associatedLayout);
	#endif
}
开发者ID:HaoDrang,项目名称:GD,代码行数:9,代码来源:ExternalLayout.cpp

示例8: SendNewGameCreated

void AnalyticsSender::SendNewGameCreated(gd::String platformName, gd::String templateName)
{
    #if !defined(GD_NO_WX_GUI)
    wxFileName templateFile = wxFileName::FileName(templateName);
    templateFile.MakeRelativeTo();

    SerializerElement data;
    data.SetAttribute("platform", platformName);
    data.SetAttribute("templateName", gd::String(templateFile.GetFullPath(wxPATH_UNIX)));
    SendData("new_game_creation", data);
    #endif
}
开发者ID:HaoDrang,项目名称:GD,代码行数:12,代码来源:AnalyticsSender.cpp

示例9: SerializeTo

void GroupEvent::SerializeTo(SerializerElement & element) const
{
    element.SetAttribute("name", name);
    element.SetAttribute("source", source);
    element.SetAttribute("creationTime", (int)creationTime);
    element.SetAttribute("colorR", (int)colorR);
    element.SetAttribute("colorG", (int)colorG);
    element.SetAttribute("colorB", (int)colorB);
    gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));

    gd::SerializerElement & parametersElement = element.AddChild("parameters");
    parametersElement.ConsiderAsArrayOf("parameter");
    for ( std::size_t i = 0;i < parameters.size();++i)
        parametersElement.AddChild("parameter").SetValue(parameters[i]);
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:15,代码来源:GroupEvent.cpp

示例10: SerializeTo

void EventsFunctionsExtension::SerializeTo(SerializerElement& element) const {
  element.SetAttribute("version", version);
  element.SetAttribute("extensionNamespace", extensionNamespace);
  element.SetAttribute("description", description);
  element.SetAttribute("name", name);
  element.SetAttribute("fullName", fullName);

  gd::SerializerElement& eventsFunctionsElement =
      element.AddChild("eventsFunctions");
  eventsFunctionsElement.ConsiderAsArrayOf("eventsFunction");
  for (const auto& eventsFunction : eventsFunctions) {
    eventsFunction->SerializeTo(
        eventsFunctionsElement.AddChild("eventsFunction"));
  }
}
开发者ID:Lizard-13,项目名称:GD,代码行数:15,代码来源:EventsFunctionsExtension.cpp

示例11: SerializeTo

void WhileEvent::SerializeTo(SerializerElement & element) const
{
    element.SetAttribute("infiniteLoopWarning", infiniteLoopWarning);
    gd::EventsListSerialization::SaveConditions(whileConditions, element.AddChild("whileConditions"));
    gd::EventsListSerialization::SaveConditions(conditions, element.AddChild("conditions"));
    gd::EventsListSerialization::SaveActions(actions, element.AddChild("actions"));
    gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));
}
开发者ID:victorlevasseur,项目名称:GD,代码行数:8,代码来源:WhileEvent.cpp

示例12: SerializeTo

void LayoutEditorCanvasOptions::SerializeTo(SerializerElement & element) const
{
    element.SetAttribute( "grid", grid);
    element.SetAttribute( "snap", snap);
    element.SetAttribute( "gridWidth", gridWidth );
    element.SetAttribute( "gridHeight", gridHeight );
    element.SetAttribute( "gridOffsetX", gridOffsetX );
    element.SetAttribute( "gridOffsetY", gridOffsetY );
    element.SetAttribute( "gridR", gridR );
    element.SetAttribute( "gridG", gridG );
    element.SetAttribute( "gridB", gridB );
    element.SetAttribute( "zoomFactor", zoomFactor );
    element.SetAttribute( "windowMask", windowMask);
    element.SetAttribute( "associatedLayout", associatedLayout);
}
开发者ID:heyuqi,项目名称:GD,代码行数:15,代码来源:LayoutEditorCanvasOptions.cpp

示例13: SerializeTo

void Variable::SerializeTo(SerializerElement & element) const
{
    if (!isStructure)
        element.SetAttribute("value", GetString());
    else
    {
        SerializerElement & childrenElement = element.AddChild("children");
        childrenElement.ConsiderAsArrayOf("variable");
        for (std::map<std::string, gd::Variable>::iterator i = children.begin(); i != children.end(); ++i)
        {
            SerializerElement & variableElement = childrenElement.AddChild("variable");
            variableElement.SetAttribute("name", i->first);
            i->second.SerializeTo(variableElement);
        }
    }
}
开发者ID:cubemoon,项目名称:GD,代码行数:16,代码来源:Variable.cpp

示例14: SerializeTo

void Object::SerializeTo(SerializerElement & element) const
{
    element.SetAttribute( "name", GetName() );
    element.SetAttribute( "type", GetType() );
    objectVariables.SerializeTo(element.AddChild("variables"));

    SerializerElement & behaviorsElement = element.AddChild("behaviors");
    behaviorsElement.ConsiderAsArrayOf("behavior");
    std::vector < gd::String > allBehaviors = GetAllBehaviorNames();
    for (std::size_t i = 0;i<allBehaviors.size();++i)
    {
        SerializerElement & behaviorElement = behaviorsElement.AddChild("behavior");

        behaviorElement.SetAttribute( "type", GetBehavior(allBehaviors[i]).GetTypeName() );
        behaviorElement.SetAttribute( "name", GetBehavior(allBehaviors[i]).GetName() );
        GetBehavior(allBehaviors[i]).SerializeTo(behaviorElement);
    }

    DoSerializeTo(element);
}
开发者ID:mateerladnam,项目名称:GD,代码行数:20,代码来源:Object.cpp

示例15: SerializeTo

void Layout::SerializeTo(SerializerElement & element) const
{
    element.SetAttribute( "name", GetName());
    element.SetAttribute( "mangledName", GetMangledName());
    element.SetAttribute( "r", (int)GetBackgroundColorRed() );
    element.SetAttribute( "v", (int)GetBackgroundColorGreen() );
    element.SetAttribute( "b", (int)GetBackgroundColorBlue() );
    element.SetAttribute( "title", GetWindowDefaultTitle());
    element.SetAttribute( "oglFOV", oglFOV );
    element.SetAttribute( "oglZNear", oglZNear );
    element.SetAttribute( "oglZFar", oglZFar );
    element.SetAttribute( "standardSortMethod", standardSortMethod);
    element.SetAttribute( "stopSoundsOnStartup", stopSoundsOnStartup);
    element.SetAttribute( "disableInputWhenNotFocused", disableInputWhenNotFocused);

    #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
    GetAssociatedLayoutEditorCanvasOptions().SerializeTo(element.AddChild("uiSettings"));
    #endif

    ObjectGroup::SerializeTo(GetObjectGroups(), element.AddChild("objectsGroups"));
    GetVariables().SerializeTo(element.AddChild("variables"));
    GetInitialInstances().SerializeTo(element.AddChild("instances"));
    SerializeObjectsTo(element.AddChild("objects"));
    gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));

    SerializerElement & layersElement = element.AddChild("layers");
    layersElement.ConsiderAsArrayOf("layer");
    for ( std::size_t j = 0;j < GetLayersCount();++j )
        GetLayer(j).SerializeTo(layersElement.AddChild("layer"));

    SerializerElement & behaviorDatasElement = element.AddChild("behaviorsSharedData");
    behaviorDatasElement.ConsiderAsArrayOf("behaviorSharedData");
    for (std::map<gd::String, std::shared_ptr<gd::BehaviorsSharedData> >::const_iterator it = behaviorsInitialSharedDatas.begin();
         it != behaviorsInitialSharedDatas.end();++it)
    {
        SerializerElement & dataElement = behaviorDatasElement.AddChild("behaviorSharedData");

        dataElement.SetAttribute("type", it->second->GetTypeName());
        dataElement.SetAttribute("name", it->second->GetName());
        it->second->SerializeTo(dataElement);
    }
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:42,代码来源:Layout.cpp


注:本文中的SerializerElement::SetAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。