From e71c213ad1acdccc2f40cec0a069ec0bd6014d02 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 28 Jan 2010 16:14:47 +0000 Subject: [PATCH] added: Pattern::Clear() git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@282 e52654a7-88a9-db11-a3e9-0013d4bc506e --- src/ezc.cpp | 25 ++++++++++++++++++++++--- src/ezc.h | 3 ++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/ezc.cpp b/src/ezc.cpp index fe1e121..51c6dd3 100644 --- a/src/ezc.cpp +++ b/src/ezc.cpp @@ -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::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() ) diff --git a/src/ezc.h b/src/ezc.h index 41de9f9..fd27ef7 100644 --- a/src/ezc.h +++ b/src/ezc.h @@ -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 {