]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/input_output/FGXMLElement.h
Merge branch 'next' of D:\Git_New\flightgear into next
[flightgear.git] / src / FDM / JSBSim / input_output / FGXMLElement.h
old mode 100755 (executable)
new mode 100644 (file)
index e4cac49..21af972
@@ -36,22 +36,15 @@ INCLUDES
 
 #include <string>
 #include <map>
-#include <iostream>
 #include <vector>
 
-using std::string;
-using std::map;
-using std::vector;
-using std::cout;
-using std::endl;
-
 #include "math/FGColumnVector3.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_XMLELEMENT "$Id$"
+#define ID_XMLELEMENT "$Id: FGXMLElement.h,v 1.16 2009/10/24 22:59:30 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -143,7 +136,7 @@ CLASS DOCUMENTATION
     - GAL = gallon (U.S. liquid) 
 
     @author Jon S. Berndt
-    @version $Id$
+    @version $Id: FGXMLElement.h,v 1.16 2009/10/24 22:59:30 jberndt Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -155,7 +148,7 @@ public:
   /** Constructor
       @param nm the name of this element (if given)
       */
-  Element(string nm);
+  Element(const std::string& nm);
   /// Destructor
   ~Element(void);
 
@@ -163,23 +156,23 @@ public:
       @param key specifies the attribute key to retrieve the value of.
       @return the key value (as a string), or the empty string if no such
               attribute exists. */
-  string GetAttributeValue(string key);
+  std::string GetAttributeValue(const std::string& key);
 
   /** Retrieves an attribute value as a double precision real number.
       @param key specifies the attribute key to retrieve the value of.
       @return the key value (as a number), or the HUGE_VAL if no such
               attribute exists. */
-  double GetAttributeValueAsNumber(string key);
+  double GetAttributeValueAsNumber(const std::string& key);
 
   /** Retrieves the element name.
       @return the element name, or the empty string if no name has been set.*/
-  string GetName(void) {return name;}
+  const std::string& GetName(void) const {return name;}
 
   /** Gets a line of data belonging to an element.
       @param i the index of the data line to return (0 by default).
       @return a string representing the data line requested, or the empty string
               if none exists.*/
-  string GetDataLine(unsigned int i=0);
+  std::string GetDataLine(unsigned int i=0);
 
   /// Returns the number of lines of data stored
   unsigned int GetNumDataLines(void) {return (unsigned int)data_lines.size();}
@@ -188,7 +181,7 @@ public:
   unsigned int GetNumElements(void) {return (unsigned int)children.size();}
 
   /// Returns the number of named child elements for this element.
-  unsigned int GetNumElements(string);
+  unsigned int GetNumElements(const std::string& element_name);
 
   /** Converts the element data to a number.
       This function attempts to convert the first (and presumably only) line of
@@ -226,7 +219,7 @@ public:
       element counter to the first element.
       @param el the search string (empty string by default).
       @return a pointer to the first element that matches the supplied search string. */
-  Element* FindElement(string el="");
+  Element* FindElement(const std::string& el="");
 
   /** Searches for the next element as specified.
       This function would be called after FindElement() is first called (in order to
@@ -237,7 +230,7 @@ public:
       @param el the name of the next element to find.
       @return the pointer to the found element, or 0 if no appropriate element us
               found.*/
-  Element* FindNextElement(string el="");
+  Element* FindNextElement(const std::string& el="");
 
   /** Searches for the named element and returns the string data belonging to it.
       This function allows the data belonging to a named element to be returned
@@ -247,7 +240,7 @@ public:
       default)
       @return the data value for the named element as a string, or the empty
               string if the element cannot be found. */
-  string FindElementValue(string el="");
+  std::string FindElementValue(const std::string& el="");
 
   /** Searches for the named element and returns the data belonging to it as a number.
       This function allows the data belonging to a named element to be returned
@@ -257,7 +250,7 @@ public:
       default)
       @return the data value for the named element as a double, or HUGE_VAL if the
               data is missing. */
-  double FindElementValueAsNumber(string el="");
+  double FindElementValueAsNumber(const std::string& el="");
 
   /** Searches for the named element and converts and returns the data belonging to it.
       This function allows the data belonging to a named element to be returned
@@ -274,7 +267,7 @@ public:
              to which the value returned will be converted.
       @return the unit-converted data value for the named element as a double,
               or HUGE_VAL if the data is missing. */
-  double FindElementValueAsNumberConvertTo(string el, string target_units);
+  double FindElementValueAsNumberConvertTo(const std::string& el, const std::string& target_units);
 
   /** Searches for the named element and converts and returns the data belonging to it.
       This function allows the data belonging to a named element to be returned
@@ -293,9 +286,9 @@ public:
              to which the value returned will be converted.
       @return the unit-converted data value for the named element as a double,
               or HUGE_VAL if the data is missing. */
-  double FindElementValueAsNumberConvertFromTo( string el,
-                                                string supplied_units,
-                                                string target_units);
+  double FindElementValueAsNumberConvertFromTo( const std::string& el,
+                                                const std::string& supplied_units,
+                                                const std::string& target_units);
 
   /** Composes a 3-element column vector for the supplied location or orientation.
       This function processes a LOCATION or ORIENTATION construct, returning a
@@ -306,7 +299,7 @@ public:
       @param target_units the string representing the native units used by JSBSim
              to which the value returned will be converted.
       @return a column vector object built from the LOCATION or ORIENT components. */
-  FGColumnVector3 FindElementTripletConvertTo( string target_units);
+  FGColumnVector3 FindElementTripletConvertTo( const std::string& target_units);
 
   /** This function sets the value of the parent class attribute to the supplied
       Element pointer.
@@ -320,11 +313,11 @@ public:
   /** Stores an attribute belonging to this element.
   *   @param name The string name of the attribute.
   *   @param value The string value of the attribute. */
-  void AddAttribute(string name, string value);
+  void AddAttribute(const std::string& name, const std::string& value);
 
   /** Stores data belonging to this element.
   *   @param d the data to store. */
-  void AddData(string d);
+  void AddData(std::string d);
 
   /** Prints the element.
   *   Prints this element and calls the Print routine for child elements.
@@ -332,14 +325,14 @@ public:
   void Print(unsigned int level=0);
 
 private:
-  string name;
-  map <string, string> attributes;
-  vector <string> data_lines;
-  vector <Element*> children;
-  vector <string> attribute_key;
+  std::string name;
+  std::map <std::string, std::string> attributes;
+  std::vector <std::string> data_lines;
+  std::vector <Element*> children;
+  std::vector <std::string> attribute_key;
   Element *parent;
   unsigned int element_index;
-  typedef map <string, map <string, double> > tMapConvert;
+  typedef std::map <std::string, std::map <std::string, double> > tMapConvert;
   static tMapConvert convert;
   static bool converterIsInitialized;
 };