Last change
on this file since 37 was
31,
checked in by rosiere, 17 years ago
|
Class Position qui encapsule la génération des fichiers de positions
|
File size:
971 bytes
|
Rev | Line | |
---|
[31] | 1 | #ifdef POSITION |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/include/Position.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | |
---|
| 14 | string Position::get_component (void) |
---|
| 15 | { |
---|
| 16 | uint32_t depth = 0; |
---|
| 17 | string separator = "\n"; |
---|
| 18 | bool last_separator = false; |
---|
| 19 | |
---|
| 20 | list<Entity *>::iterator i = _list_component->begin(); |
---|
| 21 | bool empty = _list_component->empty(); |
---|
| 22 | |
---|
| 23 | string tab = string(depth,'\t'); |
---|
| 24 | ostringstream text; |
---|
| 25 | |
---|
| 26 | if (not empty) |
---|
| 27 | { |
---|
| 28 | // First |
---|
| 29 | if (i != _list_component->end()) |
---|
| 30 | { |
---|
| 31 | text << tab << **i; |
---|
| 32 | ++i; |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | while (i != _list_component->end()) |
---|
| 36 | { |
---|
| 37 | text << separator; |
---|
| 38 | text << tab << **i; |
---|
| 39 | ++i; |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | if (last_separator) |
---|
| 43 | text << separator; |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | return text.str(); |
---|
| 47 | }; |
---|
| 48 | |
---|
| 49 | }; // end namespace behavioural |
---|
| 50 | }; // end namespace morpheo |
---|
| 51 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.