TP sur les conteneurs
Moitié du TP XML : parse et test de cercle
This commit is contained in:
parent
3420425f30
commit
8caa238c42
8 changed files with 1083 additions and 5 deletions
31
snippets/Circle.h
Normal file
31
snippets/Circle.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// Created by trotfunky on 07/05/19.
|
||||
//
|
||||
|
||||
#ifndef SNIPPETS_CIRCLE_H
|
||||
#define SNIPPETS_CIRCLE_H
|
||||
|
||||
#include <string>
|
||||
#include <pugixml.hpp>
|
||||
|
||||
namespace xmlParser
|
||||
{
|
||||
typedef struct Circle
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int r;
|
||||
|
||||
std::string label;
|
||||
|
||||
void initCirle() { x = 0; y = 1; r = 2; label = "Test circle";}
|
||||
void initCircle(pugi::xml_node node)
|
||||
{
|
||||
x = node.attribute("x").as_int(0);
|
||||
y = node.attribute("y").as_int(1);
|
||||
r = node.attribute("r").as_int(2);
|
||||
label = node.attribute("label").as_string("Test circle");
|
||||
}
|
||||
} Circle;
|
||||
}
|
||||
#endif //SNIPPETS_CIRCLE_H
|
Loading…
Add table
Add a link
Reference in a new issue