PIIODevice fullPathPrefix returns PIConstChars

This commit is contained in:
2022-05-04 16:33:05 +03:00
parent 28ce6e8f3f
commit 6995c25613
4 changed files with 36 additions and 16 deletions

View File

@@ -87,7 +87,7 @@
//! \n \a constructFullPath() should returns full unambiguous string, contains prefix and all device parameters
//! \n \a configureFromFullPath() provide configuring device from full unambiguous string without prefix and "://"
//! \n Macro PIIODEVICE should be used instead of PIOBJECT
//! \n Macro REGISTER_DEVICE should be used after definition of class, i.e. at the last line of *.cpp file
//! \n Macro REGISTER_DEVICE should be used after declaration of class, i.e. at the last line of *.h file
//! \n \n If custom I/O device corresponds there rules, it can be returned by function \a createFromFullPath().
//! \n Each PIP I/O device has custom unambiguous string description:
//! * PIFile: "file://<path>"
@@ -423,7 +423,7 @@ bool PIIODevice::configure(const PIString & config_file, const PIString & sectio
PIString PIIODevice::constructFullPath() const {
return PIStringAscii(fullPathPrefix()) + PIStringAscii("://") + constructFullPathDevice() + fullPathOptions();
return fullPathPrefix().toString() + PIStringAscii("://") + constructFullPathDevice() + fullPathOptions();
}
@@ -499,16 +499,15 @@ PIStringList PIIODevice::availableClasses() {
}
void PIIODevice::registerDevice(const char * prefix, const char * classname, PIIODevice * (*fabric)()) {
PIConstChars p(prefix);
if (p.isEmpty()) return;
void PIIODevice::registerDevice(PIConstChars prefix, PIConstChars classname, PIIODevice * (*fabric)()) {
if (prefix.isEmpty()) return;
//printf("registerDevice %s %d %d\n", prefix, p.isEmpty(), fabrics().size());
if (!fabrics().contains(p)) {
if (!fabrics().contains(prefix)) {
FabricInfo fi;
fi.prefix = prefix;
fi.classname = classname;
fi.fabricator = fabric;
fabrics()[p] = fi;
fabrics()[prefix] = fi;
}
}