version 1.3, 2001/06/17 04:20:33
|
version 1.7, 2001/07/02 01:50:10
|
|
|
#define TO_PROPERTY_NAME_INDEX 7 | #define TO_PROPERTY_NAME_INDEX 7 |
#define NUM_FIELDS 8 | #define NUM_FIELDS 8 |
| |
static inline Boolean _Match(const String& x, const String& pattern) |
static inline Boolean _MatchNoCase(const String& x, const String& pattern) |
{ | { |
return pattern.size() == 0 || x == pattern; |
return pattern.size() == 0 || String::equalNoCase(x, pattern); |
} | } |
| |
static String _Escape(const String& str) | static String _Escape(const String& str) |
|
|
default: | default: |
result += c; | result += c; |
} | } |
|
|
|
i++; |
} | } |
else | else |
result += c; | result += c; |
|
|
| |
Boolean AssocTable::containsObject( | Boolean AssocTable::containsObject( |
const String& path, | const String& path, |
const String& objectName) |
const CIMReference& objectName) |
{ | { |
// Open input file: | // Open input file: |
| |
ifstream is; | ifstream is; |
| |
if (!Open(is, path)) | if (!Open(is, path)) |
throw CannotOpenFile(path); |
return false; |
| |
// Look at each line: | // Look at each line: |
| |
|
|
| |
Boolean AssocTable::deleteAssociation( | Boolean AssocTable::deleteAssociation( |
const String& path, | const String& path, |
const String& assocInstanceName) |
const CIMReference& assocInstanceName) |
{ | { |
// Open input file: | // Open input file: |
| |
ifstream is; | ifstream is; |
| |
if (!Open(is, path)) | if (!Open(is, path)) |
throw CannotOpenFile(path); |
return false; |
| |
// Open output file: | // Open output file: |
| |
|
|
| |
Boolean AssocTable::getAssociatorNames( | Boolean AssocTable::getAssociatorNames( |
const String& path, | const String& path, |
const String& objectName, |
const CIMReference& objectName, |
const String& assocClass, | const String& assocClass, |
const String& resultClass, | const String& resultClass, |
const String& role, | const String& role, |
|
|
ifstream is; | ifstream is; |
| |
if (!Open(is, path)) | if (!Open(is, path)) |
throw CannotOpenFile(path); |
return false; |
| |
// For each line: | // For each line: |
| |
|
|
while (_GetRecord(is, fields)) | while (_GetRecord(is, fields)) |
{ | { |
if (objectName == fields[FROM_OBJECT_NAME_INDEX] && | if (objectName == fields[FROM_OBJECT_NAME_INDEX] && |
_Match(fields[ASSOC_CLASS_NAME_INDEX], assocClass) && |
_MatchNoCase(fields[ASSOC_CLASS_NAME_INDEX], assocClass) && |
_Match(fields[TO_CLASS_NAME_INDEX], resultRole) && |
_MatchNoCase(fields[TO_CLASS_NAME_INDEX], resultClass) && |
_Match(fields[FROM_PROPERTY_NAME_INDEX], role) && |
_MatchNoCase(fields[FROM_PROPERTY_NAME_INDEX], role) && |
_Match(fields[TO_PROPERTY_NAME_INDEX], resultRole)) |
_MatchNoCase(fields[TO_PROPERTY_NAME_INDEX], resultRole)) |
{ | { |
associatorNames.append(fields[TO_OBJECT_NAME_INDEX]); | associatorNames.append(fields[TO_OBJECT_NAME_INDEX]); |
found = true; | found = true; |
|
|
| |
Boolean AssocTable::getReferenceNames( | Boolean AssocTable::getReferenceNames( |
const String& path, | const String& path, |
const String& objectName, |
const CIMReference& objectName, |
const String& resultClass, | const String& resultClass, |
const String& role, | const String& role, |
Array<String>& referenceNames) | Array<String>& referenceNames) |
|
|
ifstream is; | ifstream is; |
| |
if (!Open(is, path)) | if (!Open(is, path)) |
throw CannotOpenFile(path); |
return false; |
| |
// For each line: | // For each line: |
| |
|
|
while (_GetRecord(is, fields)) | while (_GetRecord(is, fields)) |
{ | { |
if (objectName == fields[FROM_OBJECT_NAME_INDEX] && | if (objectName == fields[FROM_OBJECT_NAME_INDEX] && |
_Match(fields[ASSOC_CLASS_NAME_INDEX], resultClass) && |
_MatchNoCase(fields[ASSOC_CLASS_NAME_INDEX], resultClass) && |
_Match(fields[FROM_PROPERTY_NAME_INDEX], role)) |
_MatchNoCase(fields[FROM_PROPERTY_NAME_INDEX], role)) |
{ | { |
referenceNames.append(fields[ASSOC_INSTANCE_NAME_INDEX]); | referenceNames.append(fields[ASSOC_INSTANCE_NAME_INDEX]); |
found = true; | found = true; |