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


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

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


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

示例1: UnserializeFrom

void GroupEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
{
    name = element.GetStringAttribute("name");
    source = element.GetStringAttribute("source");
    creationTime = element.GetIntAttribute("creationTime");
    colorR = element.GetIntAttribute("colorR");
    colorG = element.GetIntAttribute("colorG");
    colorB = element.GetIntAttribute("colorB");
    gd::EventsListSerialization::UnserializeEventsFrom(project, events, element.GetChild("events"));

    parameters.clear();
    gd::SerializerElement & parametersElement = element.GetChild("parameters");
    parametersElement.ConsiderAsArrayOf("parameters");
    for ( std::size_t i = 0;i < parametersElement.GetChildrenCount();++i)
        parameters.push_back(parametersElement.GetChild(i).GetValue().GetString());
}
开发者ID:walney,项目名称:GD,代码行数:16,代码来源:GroupEvent.cpp

示例2: UnserializeFrom

/**
 * \brief Unserialize the layer.
 */
void Layer::UnserializeFrom(const SerializerElement & element)
{
    SetName(element.GetStringAttribute("name", "", "Name"));
    SetVisibility(element.GetBoolAttribute("visibility", true, "Visibility"));

    //Compatibility with GD <= 3.3
    if (element.HasChild("Camera"))
    {
        for (std::size_t i = 0; i < element.GetChildrenCount("Camera"); ++i)
        {
            const SerializerElement & cameraElement = element.GetChild("Camera", i);
            SetCameraCount(GetCameraCount()+1);
            Camera & camera = GetCamera(GetCameraCount()-1);

            camera.SetUseDefaultSize(cameraElement.GetBoolAttribute("DefaultSize", true));
            camera.SetSize(cameraElement.GetDoubleAttribute("Width"), cameraElement.GetDoubleAttribute("Height"));

            camera.SetUseDefaultViewport(cameraElement.GetBoolAttribute("DefaultViewport", true));
            camera.SetViewport(cameraElement.GetDoubleAttribute("ViewportLeft"),
                cameraElement.GetDoubleAttribute("ViewportTop"),
                cameraElement.GetDoubleAttribute("ViewportRight"),
                cameraElement.GetDoubleAttribute("ViewportBottom")
                ); // (sf::Rect used Right and Bottom instead of Width and Height before)
        }
    }
    //End of compatibility code
    else
    {
        SerializerElement & camerasElement = element.GetChild("cameras");
        camerasElement.ConsiderAsArrayOf("camera");
        for (std::size_t i = 0; i < camerasElement.GetChildrenCount(); ++i)
        {
            const SerializerElement & cameraElement = camerasElement.GetChild(i);

            SetCameraCount(GetCameraCount()+1);
            Camera & camera = GetCamera(GetCameraCount()-1);

            camera.SetUseDefaultSize(cameraElement.GetBoolAttribute("defaultSize", true));
            camera.SetSize(cameraElement.GetDoubleAttribute("width"), cameraElement.GetDoubleAttribute("height"));

            camera.SetUseDefaultViewport(cameraElement.GetBoolAttribute("defaultViewport", true));
            camera.SetViewport(cameraElement.GetDoubleAttribute("viewportLeft"),
                cameraElement.GetDoubleAttribute("viewportTop"),
                cameraElement.GetDoubleAttribute("viewportRight"),
                cameraElement.GetDoubleAttribute("viewportBottom")); // (sf::Rect used Right and Bottom instead of Width and Height before)
        }
    }

    effects.clear();
    SerializerElement & effectsElement = element.GetChild("effects");
    effectsElement.ConsiderAsArrayOf("effect");
    for (std::size_t i = 0; i < effectsElement.GetChildrenCount(); ++i)
    {
        const SerializerElement & effectElement = effectsElement.GetChild(i);

        auto effect = std::shared_ptr<gd::Effect>(new Effect);
        effect->UnserializeFrom(effectElement);
        effects.push_back(effect);
    }
}
开发者ID:ShafeeTheXenos,项目名称:GD,代码行数:63,代码来源:Layer.cpp

示例3: UnserializeFrom

void ResourceFolder::UnserializeFrom(const SerializerElement & element, gd::ResourcesManager & parentManager)
{
    name = element.GetStringAttribute("name");

    SerializerElement & resourcesElement = element.GetChild("resources", 0, "Resources");
    resourcesElement.ConsiderAsArrayOf("resource", "Resource");
    for(std::size_t i = 0;i<resourcesElement.GetChildrenCount();++i)
        AddResource(resourcesElement.GetChild(i).GetStringAttribute("name"), parentManager);
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:9,代码来源:ResourcesManager.cpp

示例4: UnserializeFrom

void EventsFunctionsExtension::UnserializeFrom(
    gd::Project& project, const SerializerElement& element) {
  version = element.GetStringAttribute("version");
  extensionNamespace = element.GetStringAttribute("extensionNamespace");
  description = element.GetStringAttribute("description");
  name = element.GetStringAttribute("name");
  fullName = element.GetStringAttribute("fullName");

  const gd::SerializerElement& eventsFunctionsElement =
      element.GetChild("eventsFunctions");
  eventsFunctions.clear();
  eventsFunctionsElement.ConsiderAsArrayOf("eventsFunction");
  for (std::size_t i = 0; i < eventsFunctionsElement.GetChildrenCount(); ++i) {
    gd::EventsFunction& newEventsFunction =
        InsertNewEventsFunction("", GetEventsFunctionsCount());

    newEventsFunction.UnserializeFrom(project,
                                      eventsFunctionsElement.GetChild(i));
  }
}
开发者ID:Lizard-13,项目名称:GD,代码行数:20,代码来源:EventsFunctionsExtension.cpp

示例5: UnserializeFrom

void LayoutEditorCanvasOptions::UnserializeFrom(const SerializerElement & element)
{
    grid = element.GetBoolAttribute("grid");
    snap = element.GetBoolAttribute("snap");
    windowMask = element.GetBoolAttribute("windowMask");
    gridWidth = element.GetIntAttribute("gridWidth", 32);
    gridHeight = element.GetIntAttribute("gridHeight", 32);
    gridOffsetX = element.GetIntAttribute("gridOffsetX", 0);
    gridOffsetY = element.GetIntAttribute("gridOffsetY", 0);
    gridR = element.GetIntAttribute("gridR", 158);
    gridG = element.GetIntAttribute("gridG", 180);
    gridB = element.GetIntAttribute("gridB", 255);
    zoomFactor = element.GetDoubleAttribute("zoomFactor", 1.0);
    associatedLayout = element.GetStringAttribute("associatedLayout");
}
开发者ID:heyuqi,项目名称:GD,代码行数:15,代码来源:LayoutEditorCanvasOptions.cpp

示例6: UnserializeFrom

void Variable::UnserializeFrom(const SerializerElement & element)
{
    isStructure = element.HasChild("children", "Children");

    if (isStructure)
    {
        const SerializerElement & childrenElement = element.GetChild("children", 0, "Children");
        childrenElement.ConsiderAsArrayOf("variable", "Variable");
        for (int i = 0; i < childrenElement.GetChildrenCount(); ++i)
        {
            const SerializerElement & childElement = childrenElement.GetChild(i);
            std::string name = childElement.GetStringAttribute("name", "", "Name");

            gd::Variable childVariable;
            childVariable.UnserializeFrom(childElement);
            children[name] = childVariable;
        }
    }
    else
        SetString(element.GetStringAttribute("value", "", "Value"));
}
开发者ID:cubemoon,项目名称:GD,代码行数:21,代码来源:Variable.cpp

示例7: UnserializeFrom

void SourceFile::UnserializeFrom(const SerializerElement & element)
{
    filename = element.GetStringAttribute("filename");
    language = element.GetStringAttribute("language", "C++");
    gdManaged = element.GetBoolAttribute("gdManaged");
}
开发者ID:Dean-Jansen,项目名称:GD,代码行数:6,代码来源:SourceFile.cpp

示例8: UnserializeFrom

void Layout::UnserializeFrom(gd::Project & project, const SerializerElement & element)
{
    SetBackgroundColor(element.GetIntAttribute( "r" ), element.GetIntAttribute( "v" ), element.GetIntAttribute( "b" ));
    SetWindowDefaultTitle( element.GetStringAttribute("title", "(No title)", "titre") );
    oglFOV = element.GetDoubleAttribute("oglFOV");
    oglZNear = element.GetDoubleAttribute("oglZNear");
    oglZFar = element.GetDoubleAttribute("oglZFar");
    standardSortMethod = element.GetBoolAttribute( "standardSortMethod" );
    stopSoundsOnStartup = element.GetBoolAttribute( "stopSoundsOnStartup" );
    disableInputWhenNotFocused = element.GetBoolAttribute( "disableInputWhenNotFocused" );

    #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
    associatedSettings.UnserializeFrom(element.GetChild("uiSettings", 0, "UISettings"));
    #endif

    #if defined(GD_IDE_ONLY)
    gd::ObjectGroup::UnserializeFrom(objectGroups, element.GetChild( "objectsGroups", 0, "GroupesObjets" ));
    gd::EventsListSerialization::UnserializeEventsFrom(project, GetEvents(), element.GetChild("events", 0, "Events"));
    #endif

    UnserializeObjectsFrom(project, element.GetChild("objects", 0, "Objets"));
    initialInstances.UnserializeFrom(element.GetChild("instances", 0, "Positions"));
    variables.UnserializeFrom(element.GetChild("variables", 0, "Variables"));

    initialLayers.clear();
    SerializerElement & layersElement = element.GetChild("layers", 0, "Layers");
    layersElement.ConsiderAsArrayOf("layer", "Layer");
    for (std::size_t i = 0; i < layersElement.GetChildrenCount(); ++i)
    {
        gd::Layer layer;

        layer.UnserializeFrom(layersElement.GetChild(i));
        initialLayers.push_back(layer);
    }

    //Compatibility with GD <= 4
    gd::String deprecatedTag1 = "automatismsSharedData";
    gd::String deprecatedTag2 = "automatismSharedData";
    if (!element.HasChild(deprecatedTag1))
    {
        deprecatedTag1 = "AutomatismsSharedDatas";
        deprecatedTag2 = "AutomatismSharedDatas";
    }
    //end of compatibility code

    SerializerElement & behaviorsDataElement = element.GetChild("behaviorsSharedData", 0, deprecatedTag1);
    behaviorsDataElement.ConsiderAsArrayOf("behaviorSharedData", deprecatedTag2);
    for (unsigned int i = 0; i < behaviorsDataElement.GetChildrenCount(); ++i)
    {
        SerializerElement & behaviorDataElement = behaviorsDataElement.GetChild(i);
        gd::String type = behaviorDataElement.GetStringAttribute("type", "", "Type")
            .FindAndReplace("Automatism", "Behavior"); //Compatibility with GD <= 4

        std::shared_ptr<gd::BehaviorsSharedData> sharedData = project.CreateBehaviorSharedDatas(type);
        if ( sharedData != std::shared_ptr<gd::BehaviorsSharedData>() )
        {
            sharedData->SetName( behaviorDataElement.GetStringAttribute("name", "", "Name") );
            sharedData->UnserializeFrom(behaviorDataElement);

            behaviorsInitialSharedDatas[sharedData->GetName()] = sharedData;
        }

    }
}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:64,代码来源:Layout.cpp


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