Makeprojects
Loading...
Searching...
No Matches
makeprojects.visual_studio.VS2003XML Class Reference

Visual Studio 2003-2008 XML formatter. More...

Inheritance diagram for makeprojects.visual_studio.VS2003XML:

Public Member Functions

 __init__ (self, name, attributes=None, force_pair=False)
 Set the defaults.
 add_attribute (self, attribute)
 Add an attribute object.
 add_attributes (self, attributes)
 Add a list of attribute objects.
 add_element (self, element)
 Add an element to this XML element.
 set_attribute (self, name, value)
 Change existing attribute.
 remove_attribute (self, name)
 Remove an attribute.
 reset_attribute (self, name)
 Reset an attribute to default.
 generate (self, line_list=None, indent=0, ide=None)
 Generate the text lines for this XML element.
 __repr__ (self)
 Convert the solution record into a human readable description.
 __str__ (self)
 Convert the solultion record into a human readable description.

Public Attributes

 name = name
 Name of this XML chunk.
 force_pair = force_pair
 Disable <foo/> syntax.
list elements = []
 List of elements in this element.
list attributes = []
 List of valid attributes and defaults.

Detailed Description

Visual Studio 2003-2008 XML formatter.

Output XML elements in the format of Visual Studio 2003-2008.

Visual Studio 2003-2008 only supports XML tags and attributes. There is no support for text between tags.

Theses are examples of XML fragments this class exports.

<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Tool
Name="VCMIDLTool"/>
<-- force_pair disables support for "/>" closure -->
<File
RelativePath=".\\source\\Win32Console.cpp">
</File>

Constructor & Destructor Documentation

◆ __init__()

makeprojects.visual_studio.VS2003XML.__init__ ( self,
name,
attributes = None,
force_pair = False )

Set the defaults.

Parameters
nameName of the XML element
attributesdict of attributes to use as defaults.
force_pairIf True, disable the use of /> XML suffix usage.

Member Function Documentation

◆ __repr__()

makeprojects.visual_studio.VS2003XML.__repr__ ( self)

Convert the solution record into a human readable description.

Returns
Human readable string or None if the solution is invalid

◆ __str__()

makeprojects.visual_studio.VS2003XML.__str__ ( self)

Convert the solultion record into a human readable description.

Returns
Human readable string or None if the solution is invalid

◆ add_attribute()

makeprojects.visual_studio.VS2003XML.add_attribute ( self,
attribute )

Add an attribute object.

Append the passed attribute to the end of the attribute list for this XML element.

Parameters
attributeA validator class instance

◆ add_attributes()

makeprojects.visual_studio.VS2003XML.add_attributes ( self,
attributes )

Add a list of attribute objects.

Iterate over the list of attribute objects and append them to the end of the attribute list.

Parameters
attributeslist of attribute objects.

◆ add_element()

makeprojects.visual_studio.VS2003XML.add_element ( self,
element )

Add an element to this XML element.

Parameters
elementVS2003XML object

◆ generate()

makeprojects.visual_studio.VS2003XML.generate ( self,
line_list = None,
indent = 0,
ide = None )

Generate the text lines for this XML element.

There is a slight difference between Visual Studio 2003 and 2005/2008 on how tags are closed. The argument ide is used to flag with close format to use.

Parameters
line_listlist object to have text lines appended to
indentnumber of tabs to insert (For recursion)
ideIDE to target.
Returns
line_list with all lines appended to it.

Reimplemented in makeprojects.visual_studio.VS2003vcproj.

◆ remove_attribute()

makeprojects.visual_studio.VS2003XML.remove_attribute ( self,
name )

Remove an attribute.

If the value is in the list, remove it.

Parameters
nameString of the entry to remove
Returns
True if found and removed, False if not present.

◆ reset_attribute()

makeprojects.visual_studio.VS2003XML.reset_attribute ( self,
name )

Reset an attribute to default.

If the attribute is in the attribute_defaults list, set it to the default, which can include the attribute removal.

Parameters
nameString of the entry to reset

◆ set_attribute()

makeprojects.visual_studio.VS2003XML.set_attribute ( self,
name,
value )

Change existing attribute.

If the attribute was not found, it will throw.

Parameters
nameString of the entry to match
valueValue to substitute