Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

func.cpp File Reference

#include <iostream>
#include <stdexcept>
#include "func.h"
#include "element.h"

Go to the source code of this file.

Functions

void setByteOrder (enum ByteOrder bo)
ElementscreateElements (Element *element)
ElementsaddElement (Elements *elements, Element *element)
ElementcreateElement (enum ComplexType type, Elements *elements, char *name)
int readNum (char *number)
ElementcreateDefinedElement (char *type, char *name, char *number)
ElementcreateSimpleElement (int type, char *name, char *number)
void processElement (enum ComplexType type, char *name, Elements *elements)

Variables

enum ByteOrder byteOrder = LittleEndian


Function Documentation

Elements* addElement Elements   elements,
Element   element
 

Definition at line 26 of file func.cpp.

References Elements::Add().

00027 {
00028         elements->Add(element);
00029         return elements;
00030 }

Element* createDefinedElement char *    type,
char *    name,
char *    number
 

Definition at line 55 of file func.cpp.

References ComplexElement::Find(), and readNum().

00056 {
00057         int n = readNum(number);
00058         
00059         // find complex element
00060         ComplexElement *ce = ComplexElement::Find(type);
00061         free(type);
00062         
00063         // !!! give some error
00064         if (!ce)
00065                 throw std::runtime_error("");
00066 
00067         return new DefinedElement(name, ce, n);
00068 }

Element* createElement enum ComplexType    type,
Elements   elements,
char *    name
 

Definition at line 33 of file func.cpp.

References ComplexType.

00034 {
00035         Element *e = new ComplexElement(name,type,elements);
00036         free(name);
00037         return e;
00038 }

Elements* createElements Element   element
 

Definition at line 18 of file func.cpp.

References Elements::Add().

00019 {
00020         Elements* e = new Elements();
00021         e->Add(element);
00022         return e;
00023 }

Element* createSimpleElement int    type,
char *    name,
char *    number
 

Definition at line 73 of file func.cpp.

References readNum().

00074 {
00075         int n = readNum(number);
00076         
00077         Element* res;
00078         if (type==0)
00079                 res = new PaddingElement(name,n==0?1:n);
00080         else
00081                 res = new SimpleElement(name,type<0,type<0?-type:type,n);
00082         free(name);
00083         return res;
00084 }

void processElement enum ComplexType    type,
char *    name,
Elements   elements
 

Definition at line 87 of file func.cpp.

References ComplexType, and ComplexElement::Process().

00088 {
00089         ComplexElement *ce = new ComplexElement(name,type,elements);
00090         free(name);
00091         
00092         ce->Process(cout);
00093 }

int readNum char *    number [static]
 

Definition at line 42 of file func.cpp.

Referenced by createDefinedElement(), and createSimpleElement().

00043 {
00044         int n = 0;
00045         if (number)
00046         {
00047                 n = atoi(number);
00048                 free(number);
00049         }
00050         return n;
00051 }

void setByteOrder enum ByteOrder    bo
 

Definition at line 9 of file func.cpp.

References ByteOrder, and byteOrder.

00010 {
00011         byteOrder = bo;
00012 }


Variable Documentation

enum ByteOrder byteOrder = LittleEndian [static]
 

Definition at line 6 of file func.cpp.

Referenced by setByteOrder().


Generated on Mon Jan 13 22:20:35 2003 for perdr by doxygen1.2.15