2 // part of libkombilo, http://www.u-go.net/kombilo/
4 // Copyright (c) 2006 Ulrich Goertz <u@g0ertz.de>
6 // Permission is hereby granted, free of charge, to any person obtaining a copy of
7 // this software and associated documentation files (the "Software"), to deal in
8 // the Software without restriction, including without limitation the rights to
9 // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10 // of the Software, and to permit persons to whom the Software is furnished to do
11 // so, subject to the following conditions:
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 typedef std::pair
<char,char> p_cc
;
40 class ExtendedMoveNumber
{
43 int* data
; // "even" entries: go right, "odd" entries: go down in game tree.
46 ExtendedMoveNumber(int LENGTH
, int* DATA
);
47 ExtendedMoveNumber(int D
);
48 ExtendedMoveNumber(const ExtendedMoveNumber
& emn
);
49 ~ExtendedMoveNumber();
51 ExtendedMoveNumber
& operator=(const ExtendedMoveNumber
& emn
);
53 void down() throw(SGFError
);
59 char* SGFescape(const char* s
);
63 PropValue(std::string IDC
, std::vector
<std::string
>* PV
);
65 std::string IDcomplete
;
66 std::vector
<std::string
>* pv
;
77 std::string SGFstring
;
79 std::vector
<std::string
> gpv(const std::string
& prop
);
80 std::vector
<std::string
>* get_property_value(const std::string
& prop
);
81 void set_property_value(std::string
& IDcomplete
, std::vector
<std::string
>* propValue
) throw(SGFError
);
83 int posyD
; // used when displaying SGF structure graphically as a tree
85 Node(Node
* prev
, char* SGFst
, int lvl
) throw(SGFError
);
87 ExtendedMoveNumber
get_move_number();
88 void parseNode() throw(SGFError
);
91 std::map
<std::string
, PropValue
> data
; // use get_property_value to access this
96 std::vector
<std::string
>* parseRootNode(Node
* n
, std::vector
<std::string
>* tags
) throw(SGFError
);
100 Cursor(const char* sgf
, int sloppy
) throw(SGFError
);
112 void parse(const char* s
) throw(SGFError
);
113 void game(int n
) throw(SGFError
);
114 void next(int n
=0) throw(SGFError
);
115 void previous() throw(SGFError
);
116 Node
* getRootNode(int n
) throw(SGFError
);
117 // void updateRootNode(PyObject* data, int n) throw(SGFError);
118 char* outputVar(Node
* node
);
121 void delVariation(Node
* node
);
125 void delVar(Node
* node
);
126 void deltree(Node
* node
);
130 std::string
nodeToString(std::map
<std::string
, PropValue
>& data
) throw(SGFError
);
131 // char* rootNodeToString(PyObject* data);