コード例 #1
0
//Gets the value of an XML declaration node
char* getDeclerationValue()
{
  //XML decleartion is the string between the question makr signs of an decleration node
  clearWhiteSpace();
  int length = 0;
  int insideQuotation = FALSE;

  //Loop until we finish reading outside of the quotes or we reach the question mark
  while((xmlArray[chrPtr] != ' ' && xmlArray[chrPtr] != '?') || insideQuotation == TRUE)
  {
    length++;
    chrPtr++;
    
    //Everything inside of quotation marks is part of the decleration
    if(xmlArray[chrPtr] == '"')
    {
      if(insideQuotation == TRUE)
      {
        insideQuotation = FALSE;
      }
      else
      {
        insideQuotation  = TRUE;
      }
    }
  }

  //read the decleration
  char *declerationvalue = readFromXML(length);

  //return the decleration that was read
  return declerationvalue;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: Safari94/CG-Project-15-16
/**Função que prepara as figuras para desenhar a partir de uma fonte .xml e invoca o ciclo glut*/
int gerar_cena(vector<string> args)
{
	string filename;
	string form;

	if (args.size() < 2){
		cout << ERROR_NUMBER_ARGS;
		return -1;
	}
	try{
		filename = args.at(1);
		if (isXML(filename) && lookUpFile(filename)){
			printf("a recolher dados para desenhar cena ...\n");
			readFromXML(filename); // Internamente à leitura geramos os modelos enquanto que na 1ª etapa
								   // eram gerados nesta mesma função
		
			// Chamada explícita para desenhar cena
			prepare_glut();
		}
	}
	catch (invalid_argument ia){
		cout << ERROR_INVALID_ARGS;
	}
	return -1;
}
コード例 #3
0
void WindowAdmin::onSendCurrentListOfTeams(vector<Team> tempListOfTeams)
{    
    listOfTeams = tempListOfTeams;

    //nadanie numeru ID
    setIDs(listOfTeams);

    saveToXML(); //zapis do XML

    /*for(unsigned int x=0; x<listOfTeams.size();x++)
    {
        this->ui->textBrowser->append(listOfTeams.at(x)));
    }
    this->ui->textBrowser->append(" "); */

    delete this->CurrentWidget; //usuwanie okna
    WindowAddTeam *Window_Add_Team = new WindowAddTeam;
    ui->CurrentWindow->addWidget(Window_Add_Team, 0,0);
    this->CurrentWidget=Window_Add_Team;

    connect(this, SIGNAL(ButtonAddEditTeam(vector<Team>)), Window_Add_Team, SLOT(onButtonAddEditTeam(vector<Team>)));
    connect(Window_Add_Team, SIGNAL(sendCurrentListOfTeams(vector<Team>)), this, SLOT(onSendCurrentListOfTeams(vector<Team>)));

    listOfTeams.clear();
    readFromXML();
    emit this->ButtonAddEditTeam(this->listOfTeams);
}
コード例 #4
0
//Gets the key/value pairs of the atributes until it 
//gets to the end of the encapsulating tag.
void getAttributes(XMLNode *xmlNode)
{
  //Clear the white space
  clearWhiteSpace();

  //Loop until we get to the end of the current tag we are in
  while(xmlArray[chrPtr] != '>')
  {
    //The attributes end with an equals sign and can not contain spaces
    int textLength = 0;
    while(xmlArray[chrPtr] != ' ' && xmlArray[chrPtr] != '=')
    {
      chrPtr++;
      textLength++;
    }

    //read the attribute
    char* attribute = readFromXML(textLength);

    //The value starts after a quotation mark after the equals sign
    moveToChar('=');
    moveToChar('"');
    chrPtr++;

    //Loop until we get to the end of the quotation mark
    textLength =0;
    while(xmlArray[chrPtr] != '"')
    {
      chrPtr++;
      textLength++;
    }

    //read the value
    char * value = readFromXML(textLength);

    //Add the attribute/value pair to the attributes of the node
    xmlAddAttribute(xmlNode, attribute, value); 

    //clean up the buffers
    free(attribute);
    free(value);
    
    //Continue moving on
    chrPtr++;
    clearWhiteSpace();
  }
}
コード例 #5
0
WindowAdmin::WindowAdmin(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::WindowAdmin)
{
    ui->setupUi(this);
    WhatsClicked = 0;
    HighestID = 0;
    race = new WindowRaceMain;
    connect(this, SIGNAL(ButtonNewRaceClicked(vector<Team>)), race, SLOT(onButtonNewRaceClicked(vector<Team>)));
    readFromXML();
}
コード例 #6
0
ファイル: main.cpp プロジェクト: MarceloRGonc/CG-Project
/**Função que prepara as figuras para desenhar a partir de uma fonte .xml e invoca o ciclo glut*/
int gerar_cena(vector<string> args)
{
	string filename;
	string form;

	if (args.size() < 2){
		cout << ERROR_NUMBER_ARGS;
		return -1;
	}
	try{
		filename = args.at(1);
		if (isXML(filename) && lookUpFile(filename)){
			printf("a recolher dados para desenhar cena ...\n");
			vector<string> files = readFromXML(filename);
			for (std::vector<string>::iterator it = files.begin(); it != files.end(); ++it){
				ifstream f((*it));
				f >> form;

				Forma* s;
				if (form.compare(FORMA_RECTANGULO) == 0){
					s = new Rectangulo();
				}
				else if (form.compare(FORMA_TRIANGULO) == 0){
					s = new Triangulo();
				}
				else if (form.compare(FORMA_CIRCULO) == 0){
					s = new Circulo();
				}
				else if (form.compare(FORMA_PARALEL) == 0){
					s = new Paralelepipedo();
				}
				else if (form.compare(FORMA_ESFERA)==0){
					s = new Esfera();
				}
				else if (form.compare(FORMA_CONE)==0){
					s = new Cone();
				}
				s->read3DfromFile((*it));
				Formas.push_back(s);
			}
			// Chamada explícita para desenhar cena
			prepare_glut();
		}
	}
	catch (invalid_argument ia){
		cout << ERROR_INVALID_ARGS;
	}
	return -1;
}
コード例 #7
0
//Get everything until the next node begins
char* getTextValue()
{
  //clearWhiteSpace();
  int textLength = 0;
  
  //Loop until the next tag starts
  while(xmlArray[chrPtr] != '<')
  {
    textLength++;
    chrPtr++;
  }
  
  //Read the text
  char *textValue = readFromXML(textLength);

  //Return the text that was read in
  return textValue;
}
コード例 #8
0
//Returns a string of all of the characters until the next space or '>' character
char* getName()
{
    //First move through all the white space
  clearWhiteSpace();

  //Loop until the next space or a closing tag
  int nameLength = 0;
  while(xmlArray[chrPtr] != '>' && xmlArray[chrPtr] != ' ')
  {
    nameLength++;
    chrPtr++;
  }

  //Read the characters from the array
  char* returnValue = readFromXML(nameLength);  

  //Return the new string
  return returnValue;
}
コード例 #9
0
void WindowAdmin::on_ButtonAddEditTeam_clicked()
{
    ui->label->hide();
    if(WhatsClicked != BUTTON_ADD_TEAM)
    {
        race->hide();
        if(WhatsClicked == BUTTON_STATS) //if STATISTICS ARE ADDED
        {
            delete this->CurrentWidget;
        }
        WhatsClicked = BUTTON_ADD_TEAM;
        WindowAddTeam *Window_Add_Team = new WindowAddTeam;

        listOfTeams.clear();
        readFromXML();

        ui->CurrentWindow->addWidget(Window_Add_Team, 0,0);
        this->CurrentWidget=Window_Add_Team;

        connect(this, SIGNAL(ButtonAddEditTeam(vector<Team>)), Window_Add_Team, SLOT(onButtonAddEditTeam(vector<Team>)));
        emit this->ButtonAddEditTeam(this->listOfTeams);
        connect(Window_Add_Team, SIGNAL(sendCurrentListOfTeams(vector<Team>)), this, SLOT(onSendCurrentListOfTeams(vector<Team>)));
    }
}
コード例 #10
0
ファイル: euitibotsim.cpp プロジェクト: AlberFernandez/MRCore
void EUITIbotSim::loadFromXMLText(char *XmlText)
{
	XML x;
	readFromXML(x.Paste(XmlText));
}
コード例 #11
0
bool AppearanceSettings::readFromFile (const File& file)
{
    const ScopedPointer<XmlElement> xml (XmlDocument::parse (file));
    return xml != nullptr && readFromXML (*xml);
}
コード例 #12
0
FixedParameters::FixedParameters(string parameters, string globalParameters) {
	readFromXML(globalParameters,true);
	readFromXML(parameters,false);
}
コード例 #13
0
FixedParameters::FixedParameters(string parameters, bool isGlobal) {
	readFromXML(parameters,isGlobal);
}