Browse Source

Remove some code that was never used anywhere.

Darryl Pogue 13 years ago
parent
commit
c1870f178b
  1. 109
      Sources/Plasma/NucleusLib/pnUtils/pnUtArray.h
  2. 48
      Sources/Plasma/NucleusLib/pnUtils/pnUtCmd.cpp
  3. 10
      Sources/Plasma/NucleusLib/pnUtils/pnUtCmd.h

109
Sources/Plasma/NucleusLib/pnUtils/pnUtArray.h

@ -62,12 +62,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define FARRAY(type) TFArray< type, TArrayCopyBits< type > >
#define FARRAYOBJ(type) TFArray< type, TArrayCopyObject< type > >
#define SORTARRAYFIELD(type, keyType, field) TSortArray< type, TArrayCopyBits< type >, keyType, offsetof(type, field)>
#define SORTARRAYFIELDOBJ(type, keyType, field) TSortArray< type, TArrayCopyObject< type >, keyType, offsetof(type, field)>
#define SORTARRAYTYPE(type) TSortArray< type, TArrayCopyBits< type >, type, 0>
#define SORTARRAYTYPEOBJ(type) TSortArray< type, TArrayCopyObject< type >, type, 0>
/****************************************************************************
*
* CBuffer
@ -978,107 +972,4 @@ template<class T, class C>
void TArray<T,C>::Trim () {
this->AdjustSize(this->m_count, this->m_count);
}
/****************************************************************************
*
* TSortArray
*
***/
template<class T, class C, class K, unsigned OFFSET>
class TSortArray : public TArray<T,C> {
private:
inline static K & SortKey (T & rec) { return *(K *)((uint8_t *)&rec + OFFSET); }
inline static const K & SortKey (const T & rec) { return *(const K *)((const uint8_t *)&rec + OFFSET); }
public:
inline bool Delete (K sortKey);
inline T * Find (K sortKey) { unsigned index; return Find(sortKey, &index); }
inline T * Find (K sortKey, unsigned * index);
inline const T * Find (K sortKey) const { unsigned index; return Find(sortKey, &index); }
inline const T * Find (K sortKey, unsigned * index) const;
inline T * Insert (K sortKey, unsigned index);
inline void Sort ();
};
//===========================================================================
template<class T, class C, class K, unsigned OFFSET>
bool TSortArray<T,C,K,OFFSET>::Delete (K sortKey) {
// Find the correct position for this key
unsigned index;
BSEARCH(T, this->Ptr(), this->Count(), (sortKey > SortKey(elem)), &index);
// Verify that an entry exists for this key
unsigned count = this->Count();
if ((index >= count) || (SortKey((*this)[index]) != sortKey))
return false;
// Delete the entry
this->DeleteOrdered(index);
return true;
}
//===========================================================================
template<class T, class C, class K, unsigned OFFSET>
T * TSortArray<T,C,K,OFFSET>::Find (K sortKey, unsigned * index) {
// Find the correct position for this key
BSEARCH(T, this->Ptr(), this->Count(), (sortKey > SortKey(elem)), index);
if (*index >= this->Count())
return nil;
// Check whether the key is at that position
T & elem = (*this)[*index];
return (SortKey(elem) == sortKey) ? &elem : nil;
}
//===========================================================================
template<class T, class C, class K, unsigned OFFSET>
const T * TSortArray<T,C,K,OFFSET>::Find (K sortKey, unsigned * index) const {
// Find the correct position for this key
BSEARCH(T, this->Ptr(), this->Count(), (sortKey > SortKey(elem)), index);
if (*index >= this->Count())
return nil;
// Check whether the key is at that position
const T & elem = (*this)[*index];
return (SortKey(elem) == sortKey) ? &elem : nil;
}
//===========================================================================
template<class T, class C, class K, unsigned OFFSET>
T * TSortArray<T,C,K,OFFSET>::Insert (K sortKey, unsigned index) {
// Insert a new entry at this position
unsigned count = this->Count();
this->SetCount(count + 1);
if (index < count)
this->Move(index + 1, index, count - index);
// Fill in the new entry
T & elem = (*this)[index];
SortKey(elem) = sortKey;
return &elem;
}
//===========================================================================
template<class T, class C, class K, unsigned OFFSET>
void TSortArray<T,C,K,OFFSET>::Sort () {
T * ptr = this->Ptr();
unsigned count = this->Count();
QSORT(
T,
ptr,
count,
SortKey(elem1) > SortKey(elem2)
);
}
#endif

48
Sources/Plasma/NucleusLib/pnUtils/pnUtCmd.cpp

@ -648,51 +648,3 @@ bool CCmdParser::Parse (const wchar_t cmdLine[]) {
return result;
}
/****************************************************************************
*
* CCmdParserSimple
*
***/
//===========================================================================
CCmdParserSimple::CCmdParserSimple (
unsigned requiredStringCount,
unsigned optionalStringCount,
const wchar_t flaggedBoolNames[] // double null terminated if used
) {
// Count the number of flagged arguments
unsigned flaggedBoolCount = 0;
const wchar_t * curr;
if (flaggedBoolNames)
for (curr = flaggedBoolNames; *curr; curr += StrLen(curr) + 1)
++flaggedBoolCount;
// Build the argument definition array
unsigned totalCount = requiredStringCount + optionalStringCount + flaggedBoolCount;
FARRAY(CmdArgDef) argDef(totalCount);
unsigned index = 0;
for (; index < requiredStringCount; ++index) {
argDef[index].flags = kCmdArgRequired | kCmdTypeString;
argDef[index].name = nil;
argDef[index].id = index + 1;
}
for (; index < requiredStringCount + optionalStringCount; ++index) {
argDef[index].flags = kCmdArgOptional | kCmdTypeString;
argDef[index].name = nil;
argDef[index].id = index + 1;
}
for (curr = flaggedBoolNames; index < totalCount; ++index) {
argDef[index].flags = kCmdArgFlagged | kCmdTypeBool;
argDef[index].name = curr;
argDef[index].id = 0;
curr += StrLen(curr) + 1;
}
// Initialize the parser
Initialize(argDef.Ptr(), argDef.Count());
}

10
Sources/Plasma/NucleusLib/pnUtils/pnUtCmd.h

@ -133,14 +133,4 @@ public:
bool Parse (const wchar_t cmdLine[] = nil);
};
class CCmdParserSimple : public CCmdParser {
public:
CCmdParserSimple (
unsigned requiredStringCount,
unsigned optionalStringCount,
const wchar_t flaggedBoolNames[] // double null terminated if used
);
};
#endif

Loading…
Cancel
Save