diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 7a7ad7f..35339a1 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -29,7 +29,7 @@ libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \ sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \ tchar.h timebomb.h timeconvert.h tw_signal.h twlimits.h twlocale.h \ twstringslang.h typed.h types.h unixexcept.h unixfsservices.h upperbound.h \ - usernotify.h usernotifystdout.h userstring.h userstringmem.h utf8.h wchar16.h + usernotify.h usernotifystdout.h utf8.h wchar16.h libcore_a_LIBADD = @CORE_CRYPT_O@ libcore_a_DEPENDENCIES = @CORE_CRYPT_O@ diff --git a/src/core/Makefile.in b/src/core/Makefile.in index 30089f9..c8b556d 100644 --- a/src/core/Makefile.in +++ b/src/core/Makefile.in @@ -355,7 +355,7 @@ libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \ sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \ tchar.h timebomb.h timeconvert.h tw_signal.h twlimits.h twlocale.h \ twstringslang.h typed.h types.h unixexcept.h unixfsservices.h upperbound.h \ - usernotify.h usernotifystdout.h userstring.h userstringmem.h utf8.h wchar16.h + usernotify.h usernotifystdout.h utf8.h wchar16.h libcore_a_LIBADD = @CORE_CRYPT_O@ libcore_a_DEPENDENCIES = @CORE_CRYPT_O@ diff --git a/src/core/package.cpp b/src/core/package.cpp deleted file mode 100644 index f9ddae8..0000000 --- a/src/core/package.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, -// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights -// reserved. -// -// This program is free software. The contents of this file are subject -// to the terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2 of the License, or (at your -// option) any later version. You may redistribute it and/or modify it -// only in compliance with the GNU General Public License. -// -// This program is distributed in the hope that it will be useful. -// However, this program is distributed AS-IS WITHOUT ANY -// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS -// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. -// -// Nothing in the GNU General Public License or any other license to use -// the code or files shall permit you to use Tripwire's trademarks, -// service marks, or other intellectual property without Tripwire's -// prior written consent. -// -// If you have any questions, please contact Tripwire, Inc. at either -// info@tripwire.org or www.tripwire.org. -// - diff --git a/src/core/userstring.cpp b/src/core/userstring.cpp deleted file mode 100644 index f94d8af..0000000 --- a/src/core/userstring.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// -// The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, -// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights -// reserved. -// -// This program is free software. The contents of this file are subject -// to the terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2 of the License, or (at your -// option) any later version. You may redistribute it and/or modify it -// only in compliance with the GNU General Public License. -// -// This program is distributed in the hope that it will be useful. -// However, this program is distributed AS-IS WITHOUT ANY -// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS -// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. -// -// Nothing in the GNU General Public License or any other license to use -// the code or files shall permit you to use Tripwire's trademarks, -// service marks, or other intellectual property without Tripwire's -// prior written consent. -// -// If you have any questions, please contact Tripwire, Inc. at either -// info@tripwire.org or www.tripwire.org. -// -// userstring.cpp -#include "stdcore.h" -#include "userstring.h" - -iUserString* iUserString::mpInstance; - diff --git a/src/core/userstring.h b/src/core/userstring.h deleted file mode 100644 index 301f8de..0000000 --- a/src/core/userstring.h +++ /dev/null @@ -1,134 +0,0 @@ -// -// The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, -// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights -// reserved. -// -// This program is free software. The contents of this file are subject -// to the terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2 of the License, or (at your -// option) any later version. You may redistribute it and/or modify it -// only in compliance with the GNU General Public License. -// -// This program is distributed in the hope that it will be useful. -// However, this program is distributed AS-IS WITHOUT ANY -// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS -// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. -// -// Nothing in the GNU General Public License or any other license to use -// the code or files shall permit you to use Tripwire's trademarks, -// service marks, or other intellectual property without Tripwire's -// prior written consent. -// -// If you have any questions, please contact Tripwire, Inc. at either -// info@tripwire.org or www.tripwire.org. -// -/////////////////////////////////////////////////////////////////////////////// -// UserString.h -- A single point of access for all strings that will be -// displayed to the end user. This implementation is intended to ease -// any future localization efforts. -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __USERSTRING_H -#define __USERSTRING_H - -#ifndef __DEBUG_H -#include "core/debug.h" -#endif - -#ifndef _MAP_ -#include -#endif - -/////////////////////////////////////////////////////////////////////////////// -// class iUserString -- Abstract interface for retrieving User Strings -/////////////////////////////////////////////////////////////////////////////// - -class iUserString -{ -public: - virtual ~iUserString() {} - - struct tStringPair - { - int id; - TCHAR* string; - }; - - // Select between the different localized string sets - // for this product. Returns false if string not defined. - virtual bool SelectStringSet(int setID) = 0; - - // Get the string from the localized string set - virtual const TCHAR* GetString(int stringID) const = 0; - - // Clear all strings in specified string set - virtual void ClearStringSet(int id) = 0; - - // Add an array of string pairs to a string set. The pair array passed in - // should terminate with an id of -1. If this string set contains string IDs - // that already exist in the string set, they will "overwrite" the - // the previous strings. - // Note: We store only pointers to the string pairs so they must remain - // around for as long as this class uses them. A static array defined at - // compile time is perfect for this. - virtual void AddStringSet(int setID, const tStringPair* pPairArray) = 0; - - // Add a single string. The above rules apply. - virtual void AddString(int setID, int stringID, TCHAR* string) = 0; - - // singleton manipulation - static iUserString* GetInstance(); - static void SetInstance(iUserString* pInst); -private: - static iUserString* mpInstance; -}; - -/////////////////////////////////////////////////////////////////////////////// -// Macros useful for building UserString tables. -/////////////////////////////////////////////////////////////////////////////// - -/* -Example Use: - - static struct iUserString::tStringPair englishStrings[] = - { - USERSTRING(STR_HELLO_WORLD, "Hello World\n") - USERSTRING(STR_OUT_OF_MEM, "Fatal Error: Out of memory.\n") - USERSTRING_END() - }; - - pUSMB->AddStringSet(LANG_USENGLISH, englishStrings); -*/ - -#define USERSTRING(id, str) { (id), _T(str) }, - -#define USERSTRING_END() { -1, _T("") } - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// inline implementation -/////////////////////////////////////////////////////////////////////////////////////////////////// -inline iUserString* iUserString::GetInstance() -{ - ASSERT(mpInstance); - - return mpInstance; -} - -inline void iUserString::SetInstance(iUserString* pInst) -{ - mpInstance = pInst; -} - - -#ifdef _MSC_VER -//#pragma warning(default:4786) -#endif /* _MSC_VER */ - -#endif // __USERSTRING_H diff --git a/src/fco/Makefile.am b/src/fco/Makefile.am index e3b6584..c74d21f 100644 --- a/src/fco/Makefile.am +++ b/src/fco/Makefile.am @@ -18,7 +18,7 @@ libfco_a_HEADERS = \ fcodatasourceiterimpl.h fcoerrors.h fcogenre.h fconame.h \ fconameinfo.h fconametbl.h fconametranslator.h fcoprop.h \ fcopropcalc.h fcopropdisplayer.h fcopropimpl.h fcopropset.h \ - fcopropsetimpl.h fcopropvector.h fcosetimpl.h fcosetws.h \ + fcopropvector.h fcosetimpl.h fcosetws.h \ fcospec.h fcospecattr.h fcospechelper.h fcospecimpl.h \ fcospeclist.h fcospecutil.h fcostrings.h fcoundefprop.h \ fcovisitor.h genreinfo.h genrespeclist.h genreswitcher.h \ diff --git a/src/fco/Makefile.in b/src/fco/Makefile.in index 1db5922..e02616a 100644 --- a/src/fco/Makefile.in +++ b/src/fco/Makefile.in @@ -338,7 +338,7 @@ libfco_a_HEADERS = \ fcodatasourceiterimpl.h fcoerrors.h fcogenre.h fconame.h \ fconameinfo.h fconametbl.h fconametranslator.h fcoprop.h \ fcopropcalc.h fcopropdisplayer.h fcopropimpl.h fcopropset.h \ - fcopropsetimpl.h fcopropvector.h fcosetimpl.h fcosetws.h \ + fcopropvector.h fcosetimpl.h fcosetws.h \ fcospec.h fcospecattr.h fcospechelper.h fcospecimpl.h \ fcospeclist.h fcospecutil.h fcostrings.h fcoundefprop.h \ fcovisitor.h genreinfo.h genrespeclist.h genreswitcher.h \ diff --git a/src/fco/fcopropsetimpl.cpp b/src/fco/fcopropsetimpl.cpp deleted file mode 100644 index aa1a8a6..0000000 --- a/src/fco/fcopropsetimpl.cpp +++ /dev/null @@ -1,212 +0,0 @@ -// -// The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, -// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights -// reserved. -// -// This program is free software. The contents of this file are subject -// to the terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2 of the License, or (at your -// option) any later version. You may redistribute it and/or modify it -// only in compliance with the GNU General Public License. -// -// This program is distributed in the hope that it will be useful. -// However, this program is distributed AS-IS WITHOUT ANY -// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS -// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. -// -// Nothing in the GNU General Public License or any other license to use -// the code or files shall permit you to use Tripwire's trademarks, -// service marks, or other intellectual property without Tripwire's -// prior written consent. -// -// If you have any questions, please contact Tripwire, Inc. at either -// info@tripwire.org or www.tripwire.org. -// -/////////////////////////////////////////////////////////////////////////////// -// propsetimpl.cpp - -#include "stdfs.h" -#include "propsetimpl.h" - -#include "core/debug.h" -#include "core/serializer.h" -#include "core/errorutil.h" -#include "fco/fcoundefprop.h" - - /////////////////////////////////////////////////////////////////////////////// -// TraceContents -/////////////////////////////////////////////////////////////////////////////// -void cPropSetImpl::TraceContents(int dl) const -{ - if(dl < 0) - dl = cDebug::D_DEBUG; - - cDebug d("cPropSetImpl::TraceContents"); - - TOSTRINGSTREAM ostr; - ostr << _T("File Sysytem Prop Set: "); - for(int i=0; iGetType() == CLASS_TYPE(cPropSetImpl)); - - // first, modify my valid vector... - mValidProps |= propsToCopy; - - for(int i=0; i < GetNumFSProps(); i++) - { - if(propsToCopy.ContainsItem(i)) - { - ASSERT( pSrc->GetValidVector().ContainsItem( i ) ); - const iFCOProp* pProp = pSrc->GetPropAt(i); - - if (pProp->GetType() != cFCOUndefinedProp::GetInstance()->GetType()) - { - GetPropAt(i)->Copy( pProp ); - mUndefinedProps.RemoveItem(i); - } - else - mUndefinedProps.AddItem(i); - } - } -} - - -/////////////////////////////////////////////////////////////////////////////// -// Invalidate -/////////////////////////////////////////////////////////////////////////////// -void cPropSetImpl::InvalidateProp(int index) -{ - ASSERT((index >= 0) && (index < GetNumProps())); - mValidProps.RemoveItem(index); -} - -void cPropSetImpl::InvalidateAll() -{ - mValidProps.Clear(); -} - -void cPropSetImpl::InvalidateProps(const cFCOPropVector& propsToInvalidate) -{ - cFCOPropVector inBoth = mValidProps; - inBoth &= propsToInvalidate; - mValidProps ^= inBoth; -} - -/////////////////////////////////////////////////////////////////////////////// -// GetNumFSProps -/////////////////////////////////////////////////////////////////////////////// -int cPropSetImpl::GetNumFSProps() -{ - return PROP_NUMITEMS; -} - -/////////////////////////////////////////////////////////////////////////////// -// ctors. dtor, operator= -/////////////////////////////////////////////////////////////////////////////// -cPropSetImpl::cPropSetImpl() : - mValidProps(cPropSetImpl::PROP_NUMITEMS), - mUndefinedProps(cPropSetImpl::PROP_NUMITEMS) -{ - // TODO: do I want to zero out all the property values here? -} - -cPropSetImpl::~cPropSetImpl() -{ - -} - -cPropSetImpl::cPropSetImpl(const cPropSetImpl& rhs) : - mValidProps(cPropSetImpl::PROP_NUMITEMS) -{ - *this = rhs; -} - -const cPropSetImpl& cPropSetImpl::operator=(const cPropSetImpl& rhs) -{ - mValidProps = rhs.GetValidVector(); - mUndefinedProps = rhs.mUndefinedProps; - - for(int i=0; i < PROP_NUMITEMS; i++) - if (mValidProps.ContainsItem(i) && !mUndefinedProps.ContainsItem(i)) - GetPropAt(i)->Copy( ((cPropSetImpl&)rhs).GetPropAt(i) ); // call non-const GetPropAt for rhs - // don't want it to assert ContainsItem - return *this; -} - -const cFCOPropVector& cPropSetImpl::GetValidVector() const -{ - return mValidProps; -} - -int cPropSetImpl::GetNumProps() const -{ - return PROP_NUMITEMS; -} - -/* -int cPropSetImpl::GetPropIndex(const TCHAR* name) const -{ - for(int i=0; i= 0) && (index < GetNumProps())); - return TSS_GetString( cFS, cPropSetImpl_PropNames[index]); -} - - */ -void cPropSetImpl::Read(iSerializer* pSerializer, int32 version) -{ - if (version > Version()) - ThrowAndAssert(eSerializerVersionMismatch(_T("Property Set Read"))); - - mValidProps.Read(pSerializer); - mUndefinedProps.Read(pSerializer); - - for (int i=0; i < PROP_NUMITEMS; i++) - { - if (mValidProps.ContainsItem(i) && !mUndefinedProps.ContainsItem(i)) - GetPropAt(i)->Read(pSerializer); - } -} - -void cPropSetImpl::Write(iSerializer* pSerializer) const -{ - mValidProps.Write(pSerializer); - mUndefinedProps.Write(pSerializer); - - for (int i=0; i < PROP_NUMITEMS; i++) - { - if (mValidProps.ContainsItem(i) && !mUndefinedProps.ContainsItem(i)) - GetPropAt(i)->Write(pSerializer); - } -} - - diff --git a/src/fco/fcopropsetimpl.h b/src/fco/fcopropsetimpl.h deleted file mode 100644 index 244b9ba..0000000 --- a/src/fco/fcopropsetimpl.h +++ /dev/null @@ -1,78 +0,0 @@ -// -// The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire, -// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights -// reserved. -// -// This program is free software. The contents of this file are subject -// to the terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2 of the License, or (at your -// option) any later version. You may redistribute it and/or modify it -// only in compliance with the GNU General Public License. -// -// This program is distributed in the hope that it will be useful. -// However, this program is distributed AS-IS WITHOUT ANY -// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS -// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. -// -// Nothing in the GNU General Public License or any other license to use -// the code or files shall permit you to use Tripwire's trademarks, -// service marks, or other intellectual property without Tripwire's -// prior written consent. -// -// If you have any questions, please contact Tripwire, Inc. at either -// info@tripwire.org or www.tripwire.org. -// -/////////////////////////////////////////////////////////////////////////////// -// fspropsetimpl.h -- file system objects' property set objects -// -// cPropSetImpl -- base class for all prop sets -// contains common implementation - -#ifndef __FSPROPSETIMPL_H -#define __FSPROPSETIMPL_H - -#ifndef __FCOPROPSET_H -#include "fco/fcopropset.h" -#endif -#ifndef __PROPSET_H -#include "fco/propset.h" -#endif - -/////////////////////////////////////////////////////////////////////////////// -// cPropSetImpl -/////////////////////////////////////////////////////////////////////////////// -class cPropSetImpl : public iFCOPropSet -{ -public: - cFSPropSet(); - cFSPropSet(const cFSPropSet& rhs); - virtual ~cFSPropSet(); - - const cFSPropSet& operator=(const cFSPropSet& rhs); - - virtual const cFCOPropVector& GetValidVector() const ; - virtual int GetNumProps () const ; - virtual int GetPropIndex(const TCHAR* name) const; - virtual TSTRING GetPropName (int index) const; - virtual const iFCOProp* GetPropAt(int index) const; - virtual iFCOProp* GetPropAt(int index) ; - virtual void InvalidateProp(int index); - virtual void InvalidateProps(const cFCOPropVector& propsToInvalidate) ; - virtual void InvalidateAll(); - virtual void CopyProps(const iFCOPropSet* pSrc, const cFCOPropVector& propsToCopy); - -private: - cFCOPropVector mValidProps; // all the properties that have been evaluated - cFCOPropVector mUndefinedProps; // properties that have been measured but have undefined values -}; - - -#endif // #ifndef __FSPROPSETIMPL_H -