C# Класс Ikayzo.SDL.Tag

SDL documents are composed of tags. A tag is composed of a name and optionally a value list, attribute list, and child list. Tags and attributes may specify namespaces.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddChild ( Tag child ) : void

Add a child to this tag

AddValue ( object value ) : void

Add a value to this tag

Equals ( object obj ) : bool

Tests for equality using ToString()

GetAttributesForNamespace ( string sdlNamespace ) : object>.IDictionary

Returns all attributes in the given namespace.

GetChild ( string childName ) : Tag

Get the first child with the given name. The search is not recursive.

GetChild ( string childName, bool recursive ) : Tag

Get the first child with the given name, optionally using a recursive search.

GetChildren ( bool recursively ) : IList

Get all the children of this tag optionally recursing through all descendents.

GetChildren ( string childName ) : IList

Get all children with the given name. The search is not recursive.

GetChildren ( string childName, bool recursive ) : IList

Get all the children with the given name (optionally searching descendants recursively)

GetChildrenForNamespace ( string sdlNamespace ) : IList

Get all children in the given namespace. The search is not recursive.

GetChildrenForNamespace ( string sdlNamespace, bool recursive ) : IList

Get all the children in the given namespace (optionally searching descendants recursively)

GetChildrenValues ( String name ) : IList

Get the values for all children with the given name. If the child has more than one value, all the values will be added as a list. If the child has no value, null will be added. The search is not recursive.

GetHashCode ( ) : int

Generates a hashcode using ToString().GetHashCode()

Read ( TextReader reader ) : Tag

Add all the tags specified in the given Reader to this Tag.

ReadFile ( String file ) : Tag

Add all the tags specified in the given file to this Tag.

ReadString ( String text ) : Tag

Add all the tags specified in the given String to this Tag.

ReadURL ( String url ) : Tag

Add all the tags specified in the file at the given URL to this Tag.

RemoveChild ( Tag child ) : bool

Remove a child from this tag

RemoveValue ( object value ) : bool

Remove a child from this tag

Tag ( string name ) : System

Create an empty tag with a name and no namespace

Tag ( string sdlNamespace, string name ) : System

Create a tag with the given namespace and name

ToString ( ) : string

Produces a full SDL "dump" of this tag. The output is valid SDL.

ToXMLString ( ) : string

Returns a string containing an XML representation of this tag. Values will be represented using _val0, _val1, etc.

Write ( TextWriter writer, bool includeRoot ) : void

Write this tag out to the given writer (optionally clipping the root.)

WriteFile ( string file ) : void

Write this tag out to the given file.

WriteFile ( string file, bool includeRoot ) : void

Write this tag out to the given file (optionally clipping the root.)

this ( int index ) : object

An indexer for the tag's values

this ( string key ) : object

An indexer for the tag's attributes. This indexer sets the attribute's namespace to an empty string ("")

this ( string sdlNamespace, string key ) : object

Set the key to the given value and sets the namespace.

Приватные методы

Метод Описание
ToString ( String linePrefix ) : string

Produces a full SDL "dump" of this tag using the given prefix before each line.

ToXMLString ( string linePrefix ) : String

Returns a string containing an XML representation of this tag. Values will be represented using _val0, _val1, etc.

Описание методов

AddChild() публичный Метод

Add a child to this tag
public AddChild ( Tag child ) : void
child Tag The child to add
Результат void

AddValue() публичный Метод

Add a value to this tag
public AddValue ( object value ) : void
value object The value to add
Результат void

Equals() публичный Метод

Tests for equality using ToString()
public Equals ( object obj ) : bool
obj object The object to test
Результат bool

GetAttributesForNamespace() публичный Метод

Returns all attributes in the given namespace.
public GetAttributesForNamespace ( string sdlNamespace ) : object>.IDictionary
sdlNamespace string The namespace to search
Результат object>.IDictionary

GetChild() публичный Метод

Get the first child with the given name. The search is not recursive.
public GetChild ( string childName ) : Tag
childName string The name of the child Tag
Результат Tag

GetChild() публичный Метод

Get the first child with the given name, optionally using a recursive search.
public GetChild ( string childName, bool recursive ) : Tag
childName string The name of the child Tag
recursive bool If the search should be recursive
Результат Tag

GetChildren() публичный Метод

Get all the children of this tag optionally recursing through all descendents.
public GetChildren ( bool recursively ) : IList
recursively bool If true, recurse through all descendents ///
Результат IList

GetChildren() публичный Метод

Get all children with the given name. The search is not recursive.
public GetChildren ( string childName ) : IList
childName string The name of the children to fetch
Результат IList

GetChildren() публичный Метод

Get all the children with the given name (optionally searching descendants recursively)
public GetChildren ( string childName, bool recursive ) : IList
childName string The name of the children to fetch
recursive bool If true search all descendents
Результат IList

GetChildrenForNamespace() публичный Метод

Get all children in the given namespace. The search is not recursive.
public GetChildrenForNamespace ( string sdlNamespace ) : IList
sdlNamespace string
Результат IList

GetChildrenForNamespace() публичный Метод

Get all the children in the given namespace (optionally searching descendants recursively)
public GetChildrenForNamespace ( string sdlNamespace, bool recursive ) : IList
sdlNamespace string The namespace of the children to /// fetch
recursive bool If true search all descendents
Результат IList

GetChildrenValues() публичный Метод

Get the values for all children with the given name. If the child has more than one value, all the values will be added as a list. If the child has no value, null will be added. The search is not recursive.
public GetChildrenValues ( String name ) : IList
name String The name of the children from which values are /// retrieved
Результат IList

GetHashCode() публичный Метод

Generates a hashcode using ToString().GetHashCode()
public GetHashCode ( ) : int
Результат int

Read() публичный Метод

Add all the tags specified in the given Reader to this Tag.
If there is an IO problem /// while reading the source If the SDL input is malformed ///
public Read ( TextReader reader ) : Tag
reader TextReader A reader containing SDL source
Результат Tag

ReadFile() публичный Метод

Add all the tags specified in the given file to this Tag.
If there is an IO problem /// while reading the source If the SDL input is malformed ///
public ReadFile ( String file ) : Tag
file String A UTF8 encoded .sdl file
Результат Tag

ReadString() публичный Метод

Add all the tags specified in the given String to this Tag.
If the SDL input is malformed ///
public ReadString ( String text ) : Tag
text String An SDL string
Результат Tag

ReadURL() публичный Метод

Add all the tags specified in the file at the given URL to this Tag.
If there is an IO problem /// while reading the source If the SDL input is malformed ///
public ReadURL ( String url ) : Tag
url String url A UTF8 encoded .sdl file
Результат Tag

RemoveChild() публичный Метод

Remove a child from this tag
public RemoveChild ( Tag child ) : bool
child Tag The child to remove
Результат bool

RemoveValue() публичный Метод

Remove a child from this tag
public RemoveValue ( object value ) : bool
value object
Результат bool

Tag() публичный Метод

Create an empty tag with a name and no namespace
If the name is not /// a valid SDL identifier
public Tag ( string name ) : System
name string The name of this tag
Результат System

Tag() публичный Метод

Create a tag with the given namespace and name
If name is not /// a valid SDL identifier or sdlNamespace is not empty and is /// not a valid SDL identifier
public Tag ( string sdlNamespace, string name ) : System
sdlNamespace string The namespace for this tag. null will /// be coerced to the empty string("")
name string The name for this tag
Результат System

ToString() публичный Метод

Produces a full SDL "dump" of this tag. The output is valid SDL.
public ToString ( ) : string
Результат string

ToXMLString() публичный Метод

Returns a string containing an XML representation of this tag. Values will be represented using _val0, _val1, etc.
public ToXMLString ( ) : string
Результат string

Write() публичный Метод

Write this tag out to the given writer (optionally clipping the root.)
If there is an IO problem during the /// write operation
public Write ( TextWriter writer, bool includeRoot ) : void
writer System.IO.TextWriter The writer to which we will write this tag ///
includeRoot bool If true this tag will be written out as /// the root element, if false only the children will be written
Результат void

WriteFile() публичный Метод

Write this tag out to the given file.
If there is an IO problem during the /// write operation
public WriteFile ( string file ) : void
file string The file path to which we will write the children /// of this tag.
Результат void

WriteFile() публичный Метод

Write this tag out to the given file (optionally clipping the root.)
If there is an IO problem during the /// write operation
public WriteFile ( string file, bool includeRoot ) : void
file string The file path to which we will write this tag ///
includeRoot bool If true this tag will be included in the /// file as the root element, if false only the children will be written ///
Результат void

this() публичный Метод

An indexer for the tag's values
public this ( int index ) : object
index int The index to get or set
Результат object

this() публичный Метод

An indexer for the tag's attributes. This indexer sets the attribute's namespace to an empty string ("")
public this ( string key ) : object
key string The key for this attribute
Результат object

this() публичный Метод

Set the key to the given value and sets the namespace.
public this ( string sdlNamespace, string key ) : object
sdlNamespace string The namespace for this attribute
key string The key for this attribute
Результат object