Remove rdctype namespace. Rename rdctype::str -> rdcstr, rdcarray, etc

* Since these types are more prevalent than originally designed, it
  makes more sense to remove the namespace for ease of typing/naming.
* Also add a specialised type 'bytebuf' for an array of bytes.
* This makes mapping easier to SWIG since there's no special casing for
  namespaced arrays. Especially so for nested cases like
  rdctype::array<rdctype::str> -> rdcarray<rdcstr>
This commit is contained in:
baldurk
2017-11-03 16:04:59 +00:00
parent 5e59616a8c
commit e6c5c03896
84 changed files with 711 additions and 679 deletions
@@ -55,8 +55,7 @@ public:
makeIconStates(exeIcon, Pixmaps::page_white_code(parent));
makeIconStates(dirIcon, Pixmaps::folder(parent));
Renderer.GetHomeFolder(true, [this](const rdctype::str &path,
const rdctype::array<PathEntry> &files) {
Renderer.GetHomeFolder(true, [this](const rdcstr &path, const rdcarray<PathEntry> &files) {
QString homeDir = path;
if(QChar(QLatin1Char(path[0])).isLetter() && path[1] == ':')
@@ -64,19 +63,19 @@ public:
NTPaths = true;
// NT paths
Renderer.ListFolder(lit("/"), true, [this, homeDir](const rdctype::str &path,
const rdctype::array<PathEntry> &files) {
for(int i = 0; i < files.count(); i++)
{
FSNode *node = new FSNode();
node->parent = NULL;
node->parentIndex = i;
node->file = files[i];
roots.push_back(node);
Renderer.ListFolder(lit("/"), true,
[this, homeDir](const rdcstr &path, const rdcarray<PathEntry> &files) {
for(int i = 0; i < files.count(); i++)
{
FSNode *node = new FSNode();
node->parent = NULL;
node->parentIndex = i;
node->file = files[i];
roots.push_back(node);
home = indexForPath(homeDir);
}
});
home = indexForPath(homeDir);
}
});
}
else
{
@@ -449,37 +448,37 @@ private:
if(!(node->file.flags & PathProperty::Directory))
return;
Renderer.ListFolder(makePath(node), true, [this, node](const rdctype::str &path,
const rdctype::array<PathEntry> &files) {
Renderer.ListFolder(
makePath(node), true, [this, node](const rdcstr &path, const rdcarray<PathEntry> &files) {
if(files.count() == 1 && (files[0].flags & PathProperty::ErrorAccessDenied))
{
node->file.flags |= PathProperty::ErrorAccessDenied;
return;
}
if(files.count() == 1 && (files[0].flags & PathProperty::ErrorAccessDenied))
{
node->file.flags |= PathProperty::ErrorAccessDenied;
return;
}
QVector<PathEntry> sortedFiles;
sortedFiles.reserve(files.count());
for(const PathEntry &f : files)
sortedFiles.push_back(f);
QVector<PathEntry> sortedFiles;
sortedFiles.reserve(files.count());
for(const PathEntry &f : files)
sortedFiles.push_back(f);
qSort(sortedFiles.begin(), sortedFiles.end(), [](const PathEntry &a, const PathEntry &b) {
// sort greater than so that files with the flag are sorted before those without
if((a.flags & PathProperty::Directory) != (b.flags & PathProperty::Directory))
return (a.flags & PathProperty::Directory) > (b.flags & PathProperty::Directory);
qSort(sortedFiles.begin(), sortedFiles.end(), [](const PathEntry &a, const PathEntry &b) {
// sort greater than so that files with the flag are sorted before those without
if((a.flags & PathProperty::Directory) != (b.flags & PathProperty::Directory))
return (a.flags & PathProperty::Directory) > (b.flags & PathProperty::Directory);
return strcmp(a.filename.c_str(), b.filename.c_str()) < 0;
});
return strcmp(a.filename.c_str(), b.filename.c_str()) < 0;
});
for(int i = 0; i < sortedFiles.count(); i++)
{
FSNode *child = new FSNode();
child->parent = node;
child->parentIndex = i;
child->file = sortedFiles[i];
node->children.push_back(child);
}
});
for(int i = 0; i < sortedFiles.count(); i++)
{
FSNode *child = new FSNode();
child->parent = node;
child->parentIndex = i;
child->file = sortedFiles[i];
node->children.push_back(child);
}
});
}
};