added: Pattern::Clear()

git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@282 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2010-01-28 16:14:47 +00:00
parent b2aacc2da3
commit e71c213ad1
2 changed files with 24 additions and 4 deletions

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2007-2008, Tomasz Sowa
* Copyright (c) 2007-2010, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -37,6 +37,7 @@
#include "ezc.h"
namespace Ezc
{
@ -121,8 +122,7 @@ void SplitUnixDirectory(const std::string & name, std::string & dir, std::string
Pattern::Pattern()
{
allow_include = true;
delete_all_white = false;
Clear();
}
@ -132,6 +132,9 @@ void Pattern::ParseFile(const std::string & file_name)
ParseFile( file_name.c_str() );
}
void Pattern::ParseFile(const char * file_name)
{
Item::Directive file;
@ -170,12 +173,24 @@ void Pattern::Directory(const char * d)
directory = d;
}
void Pattern::Directory(const std::string & d)
{
directory = d;
}
void Pattern::Clear()
{
item_root.Clear();
allow_include = true;
delete_all_white = false;
}
bool Pattern::CheckFileName(const char * name)
{
// very simple testing -- this path 'some..name' is incorrect as well
@ -701,6 +716,7 @@ Pattern::Item * Pattern::Item::AddItem(const Pattern::Item & porg)
return AddItem(&porg);
}
void Pattern::Item::ClearItems()
{
std::vector<Item*>::iterator i = item_table.begin();
@ -711,6 +727,8 @@ void Pattern::Item::ClearItems()
item_table.clear();
}
void Pattern::Item::Clear()
{
ClearItems();
@ -728,6 +746,7 @@ Pattern::Item::ItemType Pattern::Item::LastItemType()
return item_table.back()->type;
}
void Pattern::Item::DeleteLastItem()
{
if( item_table.empty() )

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2007-2008, Tomasz Sowa
* Copyright (c) 2007-2010, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -71,6 +71,7 @@ public:
void ParseString(const char * str);
void Directory(const char * d);
void Directory(const std::string & d);
void Clear();
struct Item
{