[3365] | 1 | /**************************************************************************
|
---|
| 2 | *
|
---|
| 3 | * TagInfo.cpp --
|
---|
| 4 | * Copyright (C) 1999 Rodger McNab
|
---|
| 5 | *
|
---|
| 6 | * This program is free software; you can redistribute it and/or modify
|
---|
| 7 | * it under the terms of the GNU General Public License as published by
|
---|
| 8 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 9 | * (at your option) any later version.
|
---|
| 10 | *
|
---|
| 11 | * This program is distributed in the hope that it will be useful,
|
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | * GNU General Public License for more details.
|
---|
| 15 | *
|
---|
| 16 | * You should have received a copy of the GNU General Public License
|
---|
| 17 | * along with this program; if not, write to the Free Software
|
---|
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 19 | *
|
---|
| 20 | **************************************************************************/
|
---|
| 21 |
|
---|
| 22 | #include "TagInfo.h"
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | void TagInfo::SetDocTag (const char *cStr) {
|
---|
[8692] | 26 | SetCStr (docTag, cStr, strlen(cStr));
|
---|
[3365] | 27 | }
|
---|
| 28 |
|
---|
| 29 | void TagInfo::SetIndexLevel (const char *cStr) {
|
---|
[8692] | 30 | SetCStr (indexLevel, cStr, strlen(cStr));
|
---|
[3365] | 31 | }
|
---|
| 32 | void TagInfo::AddLevelTag (const char *cStr) {
|
---|
| 33 | // convert the string
|
---|
| 34 | UCArray cArr;
|
---|
[8692] | 35 | SetCStr (cArr, cStr, strlen(cStr));
|
---|
[3365] | 36 |
|
---|
| 37 | // insert the tag
|
---|
| 38 | levelTags.insert (cArr);
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | TagInfo::TagInfo () {
|
---|
| 43 | Clear ();
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | void TagInfo::Clear () {
|
---|
| 47 | docTag.erase (docTag.begin(), docTag.end());
|
---|
| 48 | indexLevel.erase (indexLevel.begin(), indexLevel.end());
|
---|
| 49 | levelTags.erase (levelTags.begin(), levelTags.end());
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | ostream &operator<<(ostream &s, const TagInfo &t) {
|
---|
| 53 | // output docTag
|
---|
| 54 | s << "docTag: \"" << t.docTag << "\"\n";
|
---|
| 55 |
|
---|
| 56 | // output indexLevel
|
---|
| 57 | s << "indexLevel: \"" << t.indexLevel << "\"\n";
|
---|
| 58 |
|
---|
| 59 | // output levelTags
|
---|
| 60 | s << "levelTags: ";
|
---|
| 61 |
|
---|
| 62 | UCArraySet::const_iterator here = t.levelTags.begin();
|
---|
| 63 | UCArraySet::const_iterator end = t.levelTags.end();
|
---|
| 64 | while (here != end) {
|
---|
| 65 | s << "\"" << (*here) << "\"";
|
---|
[8692] | 66 | ++here;
|
---|
[3365] | 67 | if (here != end) s << ", ";
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | s << "\n";
|
---|
| 71 |
|
---|
| 72 | return s;
|
---|
| 73 | }
|
---|
| 74 |
|
---|