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


C++ SerializerElement类代码示例

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


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

示例1: SerializeTo

void RepeatEvent::SerializeTo(SerializerElement & element) const
{
    element.AddChild("repeatExpression").SetValue(repeatNumberExpression.GetPlainString());
    gd::EventsListSerialization::SaveConditions(conditions, element.AddChild("conditions"));
    gd::EventsListSerialization::SaveActions(actions, element.AddChild("actions"));
    gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));
}
开发者ID:heyuqi,项目名称:GD,代码行数:7,代码来源:RepeatEvent.cpp

示例2: 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

示例3: UnserializeFrom

void ExternalEvents::UnserializeFrom(gd::Project & project, const SerializerElement & element)
{
    name = element.GetStringAttribute("name", "", "Name");
    associatedScene = element.GetStringAttribute("associatedLayout", "", "AssociatedScene");
    lastChangeTimeStamp = element.GetIntAttribute("lastChangeTimeStamp", 0, "LastChangeTimeStamp");
    gd::EventsListSerialization::UnserializeEventsFrom(project, events, element.GetChild("events", 0, "Events"));
}
开发者ID:HaoDrang,项目名称:GD,代码行数:7,代码来源:ExternalEvents.cpp

示例4: UnserializeFrom

void RepeatEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
{
    repeatNumberExpression = gd::Expression(element.GetChild("repeatExpression", 0, "RepeatExpression").GetValue().GetString());
    gd::EventsListSerialization::OpenConditions(project, conditions, element.GetChild("conditions", 0, "Conditions"));
    gd::EventsListSerialization::OpenActions(project, actions, element.GetChild("actions", 0, "Actions"));
    gd::EventsListSerialization::UnserializeEventsFrom(project, events, element.GetChild("events", 0, "Events"));
}
开发者ID:heyuqi,项目名称:GD,代码行数:7,代码来源:RepeatEvent.cpp

示例5: 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

示例6: 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

示例7: 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

示例8: GetName

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

示例9: 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

示例10: UnserializeFrom

void ObjectGroup::UnserializeFrom(std::vector < gd::ObjectGroup > & list, const SerializerElement & element)
{
    element.ConsiderAsArrayOf("group", "Groupe");
    for (unsigned int i = 0; i < element.GetChildrenCount(); ++i)
    {
        SerializerElement & groupElement = element.GetChild(i);
        gd::ObjectGroup objectGroup;

        objectGroup.SetName(groupElement.GetStringAttribute("name", "", "nom"));

        //Compatibility with GD <= 3.3
        if ( groupElement.HasChild("Objet") )
        {
            for (unsigned int j = 0; j < groupElement.GetChildrenCount("Objet"); ++j)
                objectGroup.AddObject(groupElement.GetChild("Objet", j).GetStringAttribute("nom"));
        }
        //End of compatibility code
        else
        {
            SerializerElement & objectsElement = groupElement.GetChild("objects");
            objectsElement.ConsiderAsArrayOf("object");
            for (unsigned int j = 0; j < objectsElement.GetChildrenCount(); ++j)
                objectGroup.AddObject(objectsElement.GetChild(j).GetStringAttribute("name"));
        }

        list.push_back( objectGroup );
    }
}
开发者ID:cubemoon,项目名称:GD,代码行数:28,代码来源:ObjectGroup.cpp

示例11: CreateResource

void ResourcesManager::UnserializeFrom(const SerializerElement & element)
{
    const SerializerElement & resourcesElement = element.GetChild("resources", 0, "Resources");
    resourcesElement.ConsiderAsArrayOf("resource", "Resource");
    for(std::size_t i = 0;i<resourcesElement.GetChildrenCount();++i)
    {
        const SerializerElement & resourceElement = resourcesElement.GetChild(i);
        gd::String kind = resourceElement.GetStringAttribute("kind");
        gd::String name = resourceElement.GetStringAttribute("name");

        std::shared_ptr<Resource> resource = CreateResource(kind);
        resource->SetName(name);
        resource->UnserializeFrom(resourceElement);

        resources.push_back(resource);
    }

    #if defined(GD_IDE_ONLY)
    const SerializerElement & resourcesFoldersElement = element.GetChild("resourceFolders", 0, "ResourceFolders");
    resourcesFoldersElement.ConsiderAsArrayOf("folder", "Folder");
    for(std::size_t i = 0;i<resourcesFoldersElement.GetChildrenCount();++i)
    {
        ResourceFolder folder;
        folder.UnserializeFrom(resourcesFoldersElement.GetChild(i), *this);

        folders.push_back(folder);
    }
    #endif
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:29,代码来源:ResourcesManager.cpp

示例12: UnserializeFrom

void ImageResource::UnserializeFrom(const SerializerElement & element)
{
    alwaysLoaded = element.GetBoolAttribute("alwaysLoaded");
    smooth = element.GetBoolAttribute("smoothed");
    SetUserAdded( element.GetBoolAttribute("userAdded") );
    SetFile(element.GetStringAttribute("file"));
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:7,代码来源:ResourcesManager.cpp

示例13: UnserializeFrom

void LinkEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
{
    SerializerElement & includeElement = element.GetChild("include", 0, "Limites");

    SetTarget(element.GetChild("target", 0, "Scene").GetValue().GetString());

    if(includeElement.HasAttribute("includeAll"))
    {
        //Compatibility with GDevelop <= 4.0.92
        if(includeElement.GetBoolAttribute("includeAll", true))
        {
            SetIncludeAllEvents();
        }
        else
        {
            SetIncludeStartAndEnd(includeElement.GetIntAttribute("start"),
                includeElement.GetIntAttribute("end"));
        }
    }
    else
    {
        //GDevelop > 4.0.92
        IncludeConfig config = static_cast<IncludeConfig>(includeElement.GetIntAttribute("includeConfig", 0));
        if(config == INCLUDE_ALL)
            SetIncludeAllEvents();
        else if(config == INCLUDE_EVENTS_GROUP)
            SetIncludeEventsGroup(includeElement.GetStringAttribute("eventsGroup"));
        else if(config == INCLUDE_BY_INDEX)
            SetIncludeStartAndEnd(includeElement.GetIntAttribute("start"), includeElement.GetIntAttribute("end"));
    }

}
开发者ID:trinajstica,项目名称:GD,代码行数:32,代码来源:LinkEvent.cpp

示例14: UnserializeFrom

void ForEachEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
{
    objectsToPick = gd::Expression(element.GetChild("object", 0, "Object").GetValue().GetString());
    gd::EventsListSerialization::OpenConditions(project, conditions, element.GetChild("conditions", 0, "Conditions"));
    gd::EventsListSerialization::OpenActions(project, actions, element.GetChild("actions", 0, "Actions"));
    gd::EventsListSerialization::UnserializeEventsFrom(project, events, element.GetChild("events", 0, "Events"));
}
开发者ID:bran921007,项目名称:GD,代码行数:7,代码来源:ForEachEvent.cpp

示例15: SerializeTo

void ForEachEvent::SerializeTo(SerializerElement & element) const
{
    element.AddChild("object").SetValue(objectsToPick.GetPlainString());
    gd::EventsListSerialization::SaveConditions(conditions, element.AddChild("conditions"));
    gd::EventsListSerialization::SaveActions(actions, element.AddChild("actions"));
    gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));
}
开发者ID:bran921007,项目名称:GD,代码行数:7,代码来源:ForEachEvent.cpp


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