|
@@ -13,10 +13,7 @@
|
|
|
#include "lub/string.h"
|
|
|
#include "private.h"
|
|
|
|
|
|
-
|
|
|
-/*---------------------------------------------------------
|
|
|
- * PRIVATE METHODS
|
|
|
- *--------------------------------------------------------- */
|
|
|
+/*--------------------------------------------------------- */
|
|
|
static void clish_config_init(clish_config_t *this)
|
|
|
{
|
|
|
this->op = CLISH_CONFIG_NONE;
|
|
@@ -38,9 +35,7 @@ static void clish_config_fini(clish_config_t *this)
|
|
|
lub_string_free(this->depth);
|
|
|
}
|
|
|
|
|
|
-/*---------------------------------------------------------
|
|
|
- * PUBLIC META FUNCTIONS
|
|
|
- *--------------------------------------------------------- */
|
|
|
+/*--------------------------------------------------------- */
|
|
|
clish_config_t *clish_config_new(void)
|
|
|
{
|
|
|
clish_config_t *this = malloc(sizeof(clish_config_t));
|
|
@@ -51,113 +46,26 @@ clish_config_t *clish_config_new(void)
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
-/*---------------------------------------------------------
|
|
|
- * PUBLIC METHODS
|
|
|
- *--------------------------------------------------------- */
|
|
|
+/*--------------------------------------------------------- */
|
|
|
void clish_config_delete(clish_config_t *this)
|
|
|
{
|
|
|
clish_config_fini(this);
|
|
|
free(this);
|
|
|
}
|
|
|
|
|
|
-/*---------------------------------------------------------
|
|
|
- * PUBLIC ATTRIBUTES
|
|
|
- *--------------------------------------------------------- */
|
|
|
-void clish_config__set_op(clish_config_t *this, clish_config_op_e op)
|
|
|
-{
|
|
|
- this->op = op;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-clish_config_op_e clish_config__get_op(const clish_config_t *this)
|
|
|
-{
|
|
|
- return this->op;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-void clish_config__set_priority(clish_config_t *this, unsigned short priority)
|
|
|
-{
|
|
|
- this->priority = priority;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-unsigned short clish_config__get_priority(const clish_config_t *this)
|
|
|
-{
|
|
|
- return this->priority;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-void clish_config__set_pattern(clish_config_t *this, const char *pattern)
|
|
|
-{
|
|
|
- assert(!this->pattern);
|
|
|
- this->pattern = lub_string_dup(pattern);
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-char *clish_config__get_pattern(const clish_config_t *this)
|
|
|
-{
|
|
|
- return this->pattern;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-void clish_config__set_file(clish_config_t *this, const char *file)
|
|
|
-{
|
|
|
- assert(!this->file);
|
|
|
- this->file = lub_string_dup(file);
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-char *clish_config__get_file(const clish_config_t *this)
|
|
|
-{
|
|
|
- return this->file;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-bool_t clish_config__get_splitter(const clish_config_t *this)
|
|
|
-{
|
|
|
- return this->splitter;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-void clish_config__set_splitter(clish_config_t *this, bool_t splitter)
|
|
|
-{
|
|
|
- this->splitter = splitter;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-void clish_config__set_seq(clish_config_t *this, const char *seq)
|
|
|
-{
|
|
|
- assert(!this->seq);
|
|
|
- this->seq = lub_string_dup(seq);
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-const char *clish_config__get_seq(const clish_config_t *this)
|
|
|
-{
|
|
|
- return this->seq;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-bool_t clish_config__get_unique(const clish_config_t *this)
|
|
|
-{
|
|
|
- return this->unique;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-void clish_config__set_unique(clish_config_t *this, bool_t unique)
|
|
|
-{
|
|
|
- this->unique = unique;
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-void clish_config__set_depth(clish_config_t *this, const char *depth)
|
|
|
-{
|
|
|
- assert(!this->depth);
|
|
|
- this->depth = lub_string_dup(depth);
|
|
|
-}
|
|
|
-
|
|
|
-/*--------------------------------------------------------- */
|
|
|
-const char *clish_config__get_depth(const clish_config_t *this)
|
|
|
-{
|
|
|
- return this->depth;
|
|
|
-}
|
|
|
+CLISH_SET(config, clish_config_op_e, op);
|
|
|
+CLISH_GET(config, clish_config_op_e, op);
|
|
|
+CLISH_SET(config, unsigned short, priority);
|
|
|
+CLISH_GET(config, unsigned short, priority);
|
|
|
+CLISH_SET(config, bool_t, splitter);
|
|
|
+CLISH_GET(config, bool_t, splitter);
|
|
|
+CLISH_SET(config, bool_t, unique);
|
|
|
+CLISH_GET(config, bool_t, unique);
|
|
|
+CLISH_SET_STR_ONCE(config, pattern);
|
|
|
+CLISH_GET_STR(config, pattern);
|
|
|
+CLISH_SET_STR_ONCE(config, file);
|
|
|
+CLISH_GET_STR(config, file);
|
|
|
+CLISH_SET_STR_ONCE(config, seq);
|
|
|
+CLISH_GET_STR(config, seq);
|
|
|
+CLISH_SET_STR_ONCE(config, depth);
|
|
|
+CLISH_GET_STR(config, depth);
|