summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2020-04-21 01:00:59 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2020-04-21 01:00:59 +0200
commit3addad2cfa45de0252b63adfa8c3f868076c3f40 (patch)
tree58ea79d58c65dda0017c23c207854cd415d0e216
parent85a1c875782b3ac10020a64a937d660b2b46d3b0 (diff)
downloadcc4group-3addad2cfa45de0252b63adfa8c3f868076c3f40.tar.gz
cc4group-3addad2cfa45de0252b63adfa8c3f868076c3f40.zip
Add cc4group.isPacked
-rw-r--r--src/cc4group.c6
-rw-r--r--src/cc4group.h4
-rw-r--r--src/cppc4group.cpp5
-rw-r--r--src/cppc4group.hpp1
4 files changed, 16 insertions, 0 deletions
diff --git a/src/cc4group.c b/src/cc4group.c
index 1fc0584..da1ead4 100644
--- a/src/cc4group.c
+++ b/src/cc4group.c
@@ -3316,6 +3316,11 @@ static bool cc4group_isChild(const CC4Group* const this)
return this->parent != NULL;
}
+static bool cc4group_isPacked(const CC4Group* const this)
+{
+ return this->root.path != NULL;
+}
+
static const char* cc4group_getName(const CC4Group* const this)
{
return this->name;
@@ -3511,6 +3516,7 @@ CC4Group_API cc4group = {
.openAsChild = cc4group_openAsChild,
.isChild = cc4group_isChild,
+ .isPacked = cc4group_isPacked,
.getName = cc4group_getName,
.getFullName = cc4group_getFullName
diff --git a/src/cc4group.h b/src/cc4group.h
index 6365f82..51bacbb 100644
--- a/src/cc4group.h
+++ b/src/cc4group.h
@@ -435,6 +435,10 @@ typedef struct {
// NOTE: this function can't fail, thus the return value is the result value, not the success indication
bool (*isChild)(const CC4Group* const this);
+ // returns wether this group is packed or loaded from a normal directory
+ // NOTE: this function can't fail, thus the return value is the result value, not the success indication
+ bool (*isPacked)(const CC4Group* const this);
+
// returns the filename of the group file, if known, or directory name of the child-root entry for openAsChild groups
// might return NULL if not determinable (e.g. if not opened from file)
diff --git a/src/cppc4group.cpp b/src/cppc4group.cpp
index d2a2245..7249854 100644
--- a/src/cppc4group.cpp
+++ b/src/cppc4group.cpp
@@ -493,6 +493,11 @@ bool CppC4Group::isChild() const
return cc4group.isChild(p->g);
}
+bool CppC4Group::isPacked() const
+{
+ return cc4group.isPacked(p->g);
+}
+
std::string CppC4Group::getName() const
{
std::string ret;
diff --git a/src/cppc4group.hpp b/src/cppc4group.hpp
index d80ffdf..346e8cb 100644
--- a/src/cppc4group.hpp
+++ b/src/cppc4group.hpp
@@ -194,6 +194,7 @@ public:
// to get the child group out of the optional in case of success, construct a new CppC4Group with the move constructor: CppC4Group child{std::move(*optionalChild)};
std::optional<CppC4Group> openAsChild(const std::string& path);
bool isChild() const;
+ bool isPacked() const;
std::string getName() const;
std::string getFullName() const;