remove unused Tag class
This commit is contained in:
parent
0eb89cad32
commit
001c6323f5
|
@ -13,7 +13,7 @@ Pin.h Pins.h Plug.h Plugs.h Point.h Points.h Primitives.h Properties.h
|
|||
Property.h QuadTree.h Quark.h Quarks.h Record.h Reference.h References.h Region.h
|
||||
Relation.h RoutingPad.h RoutingPads.h Rubber.h Rubbers.h Segment.h Segments.h Selectors.h
|
||||
SetCollection.h SharedName.h SharedPathes.h SharedPath.h Slice.h Slices.h
|
||||
SlotAdapter.h Slot.h Symbols.h Tabulation.h Tag.h Tags.h Technology.h Timer.h
|
||||
SlotAdapter.h Slot.h Symbols.h Tabulation.h Technology.h Timer.h
|
||||
Transformation.h Unit.h UpdateSession.h UserGo.h UserGos.h VectorCollection.h Vertical.h
|
||||
Verticals.h Views.h Warning.h)
|
||||
|
||||
|
@ -27,7 +27,7 @@ Pad.cpp Path.cpp Pin.cpp Plug.cpp Point.cpp Property.cpp
|
|||
QuadTree.cpp Quark.cpp Record.cpp Reference.cpp Region.cpp
|
||||
Relation.cpp RoutingPad.cpp Rubber.cpp Segment.cpp SharedName.cpp
|
||||
SharedPath.cpp Slice.cpp SlotAdapter.cpp Slot.cpp Tabulation.cpp
|
||||
Tag.cpp Technology.cpp Timer.cpp Transformation.cpp Unit.cpp UpdateSession.cpp
|
||||
Technology.cpp Timer.cpp Transformation.cpp Unit.cpp UpdateSession.cpp
|
||||
UserGo.cpp Vertical.cpp Warning.cpp)
|
||||
|
||||
add_library(hurricane SHARED ${cpps})
|
||||
|
|
|
@ -1,157 +0,0 @@
|
|||
// ****************************************************************************************************
|
||||
// File: Tag.cpp
|
||||
// Authors: R. Escassut
|
||||
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
|
||||
// ****************************************************************************************************
|
||||
|
||||
#include "Tag.h"
|
||||
#include "Error.h"
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Utilitarians
|
||||
// ****************************************************************************************************
|
||||
|
||||
static bool Read(FILE* file, unsigned& rank, string& name, string& argument)
|
||||
// *************************************************************************
|
||||
{
|
||||
rank = 0;
|
||||
name = "";
|
||||
argument = "";
|
||||
|
||||
char c = fgetc(file);
|
||||
|
||||
if (c == EOF) return false;
|
||||
|
||||
while ((c != EOF) && (c == '\t')) {
|
||||
rank++;
|
||||
c = fgetc(file);
|
||||
}
|
||||
|
||||
if (c == '#') {
|
||||
while ((c != EOF) && (c != '\n')) c = fgetc(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
while ((c != EOF) && ((c == '\t') || (c == ' ')))
|
||||
c = fgetc(file);
|
||||
|
||||
while ((c != EOF) && (c != '\t') && (c != ' ') && (c != '\n')) {
|
||||
name += c;
|
||||
c = fgetc(file);
|
||||
}
|
||||
|
||||
while ((c != EOF) && ((c == '\t') || (c == ' ')))
|
||||
c = fgetc(file);
|
||||
|
||||
while ((c != EOF) && (c != '\n')) {
|
||||
argument += c;
|
||||
c = fgetc(file);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Tag implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Tag::Tag(Tag* tag, unsigned line, unsigned rank, const string& name, const string& argument)
|
||||
// *****************************************************************************************
|
||||
: _tag(tag),
|
||||
_line(line),
|
||||
_rank(rank),
|
||||
_name(name),
|
||||
_argument(argument),
|
||||
_tagList()
|
||||
{
|
||||
if (_tag) _tag->_tagList.push_back(this);
|
||||
}
|
||||
|
||||
Tag::Tag(const string& filePathName, const string& name)
|
||||
// *****************************************************
|
||||
: _tag(NULL),
|
||||
_line(0),
|
||||
_rank(0),
|
||||
_name(name),
|
||||
_argument(filePathName),
|
||||
_tagList()
|
||||
{
|
||||
if (filePathName.empty())
|
||||
throw Error("Can't create " + _TName("Tag") + " from file : empty file pathname");
|
||||
|
||||
FILE* file = fopen(filePathName.c_str(), "r");
|
||||
if (!file)
|
||||
throw Error("Can't create " + _TName("Tag") + ", unreadable file : " + filePathName);
|
||||
|
||||
unsigned rank;
|
||||
string token;
|
||||
string argument;
|
||||
unsigned line = 1;
|
||||
|
||||
while (Read(file, rank, token, argument)) {
|
||||
if (!token.empty()) new Tag(this, line, rank, token, argument);
|
||||
line++;
|
||||
}
|
||||
fclose(file);
|
||||
|
||||
stack<Tag*> tagStack;
|
||||
TagList::iterator it = _tagList.begin();
|
||||
while (it != _tagList.end()) {
|
||||
Tag* tag = *it++;
|
||||
unsigned rank = tag->_rank;
|
||||
while (!tagStack.empty() && (rank <= tagStack.top()->_rank)) tagStack.pop();
|
||||
Tag* parent = (tagStack.empty()) ? NULL : tagStack.top();
|
||||
if (parent && (parent->_rank != (rank - 1))) parent = NULL;
|
||||
if (!parent) {
|
||||
if (rank)
|
||||
throw Error("Syntax error : bad indentation (line " + GetString(tag->_line) + ")");
|
||||
}
|
||||
else {
|
||||
_tagList.remove(tag);
|
||||
tag->_tag = parent;
|
||||
parent->_tagList.push_back(tag);
|
||||
}
|
||||
tagStack.push(tag);
|
||||
}
|
||||
}
|
||||
|
||||
Tag::~Tag()
|
||||
// ********
|
||||
{
|
||||
if (_tag) _tag->_tagList.remove(this);
|
||||
|
||||
while (!_tagList.empty()) delete *_tagList.begin();
|
||||
}
|
||||
|
||||
string Tag::_GetString() const
|
||||
// ***************************
|
||||
{
|
||||
return "<" + _TName("Tag") + " " + _name + " " + _argument + ">";
|
||||
}
|
||||
|
||||
Record* Tag::_GetRecord() const
|
||||
// **********************
|
||||
{
|
||||
Record* record = new Record(GetString(this));
|
||||
record->Add(GetSlot("Tag", _tag));
|
||||
record->Add(GetSlot("Line", &_line));
|
||||
record->Add(GetSlot("Rank", &_rank));
|
||||
record->Add(GetSlot("Name", &_name));
|
||||
record->Add(GetSlot("Argument", &_argument));
|
||||
record->Add(GetSlot("Tags", &_tagList));
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
|
||||
// ****************************************************************************************************
|
|
@ -1,92 +0,0 @@
|
|||
// ****************************************************************************************************
|
||||
// File: Tag.h
|
||||
// Authors: R. Escassut
|
||||
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
|
||||
// ****************************************************************************************************
|
||||
|
||||
#ifndef HURRICANE_TAG
|
||||
#define HURRICANE_TAG
|
||||
|
||||
#include "Tags.h"
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Tag declaration
|
||||
// ****************************************************************************************************
|
||||
|
||||
class Tag {
|
||||
// ******
|
||||
|
||||
// Types
|
||||
// *****
|
||||
|
||||
public: typedef list<Tag*> TagList;
|
||||
|
||||
// Attributes
|
||||
// **********
|
||||
|
||||
private: Tag* _tag;
|
||||
private: unsigned _line;
|
||||
private: unsigned _rank;
|
||||
private: string _name;
|
||||
private: string _argument;
|
||||
private: TagList _tagList;
|
||||
|
||||
// Constructors
|
||||
// ************
|
||||
|
||||
private: Tag(Tag* tag, unsigned line, unsigned rank, const string& name, const string& argument);
|
||||
|
||||
public: Tag(const string& filePathName, const string& name);
|
||||
|
||||
private: Tag(const Tag& tag); // not implemented to forbid copy
|
||||
|
||||
// Destructor
|
||||
// **********
|
||||
|
||||
public: ~Tag();
|
||||
|
||||
// Operators
|
||||
// *********
|
||||
|
||||
private: Tag& operator=(const Tag& tag); // not implemented to forbid assignment
|
||||
|
||||
// Accessors
|
||||
// *********
|
||||
|
||||
public: Tag* GetTag() const {return _tag;};
|
||||
public: unsigned GetLine() const {return _line;};
|
||||
public: unsigned GetRank() const {return _rank;};
|
||||
public: const string& GetName() const {return _name;};
|
||||
public: const string& GetArgument() const {return _argument;};
|
||||
public: Tags GetTags() const {return GetCollection(_tagList);};
|
||||
|
||||
// Others
|
||||
// ******
|
||||
|
||||
public: string _GetTypeName() const { return _TName("Tag"); };
|
||||
public: string _GetString() const;
|
||||
public: Record* _GetRecord() const;
|
||||
public: TagList& _GetTagList() {return _tagList;};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Globals
|
||||
// ****************************************************************************************************
|
||||
|
||||
|
||||
#endif // HURRICANE_TAG
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
|
||||
// ****************************************************************************************************
|
|
@ -1,62 +0,0 @@
|
|||
// ****************************************************************************************************
|
||||
// File: Tags.h
|
||||
// Authors: R. Escassut
|
||||
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
|
||||
// ****************************************************************************************************
|
||||
|
||||
#ifndef HURRICANE_TAGS
|
||||
#define HURRICANE_TAGS
|
||||
|
||||
#include "Collection.h"
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
class Tag;
|
||||
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Tags declaration
|
||||
// ****************************************************************************************************
|
||||
|
||||
typedef GenericCollection<Tag*> Tags;
|
||||
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// TagLocator declaration
|
||||
// ****************************************************************************************************
|
||||
|
||||
typedef GenericLocator<Tag*> TagLocator;
|
||||
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// TagFilter declaration
|
||||
// ****************************************************************************************************
|
||||
|
||||
typedef GenericFilter<Tag*> TagFilter;
|
||||
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// for_each_tag declaration
|
||||
// ****************************************************************************************************
|
||||
|
||||
#define for_each_tag(tag, tags)\
|
||||
/******************************/\
|
||||
{\
|
||||
TagLocator _locator = tags.GetLocator();\
|
||||
while (_locator.IsValid()) {\
|
||||
Tag* tag = _locator.GetElement();\
|
||||
_locator.Progress();
|
||||
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
#endif // HURRICANE_TAGS
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
|
||||
// ****************************************************************************************************
|
Loading…
Reference in New Issue