From 693399c7b9ad31561b65c4e2eb5c713defc51b32 Mon Sep 17 00:00:00 2001 From: ilor <kailoran@gmail.com> Date: Wed, 27 Oct 2010 12:32:40 +0200 Subject: [PATCH] make tagset's const char* ctor a static creation function --- libcorpus2/tagset.cpp | 5 ++--- libcorpus2/tagset.h | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libcorpus2/tagset.cpp b/libcorpus2/tagset.cpp index 5f86203..538d2c2 100644 --- a/libcorpus2/tagset.cpp +++ b/libcorpus2/tagset.cpp @@ -73,12 +73,11 @@ Tagset::Tagset() { } -Tagset::Tagset(const char *s) - : id_(++next_id_) +Tagset Tagset::from_data(const char *s) { std::stringstream ss; ss << s; - *this = TagsetParser::load_ini(ss); + return TagsetParser::load_ini(ss); } std::string Tagset::id_string() const diff --git a/libcorpus2/tagset.h b/libcorpus2/tagset.h index 88b0aa2..44cfbf2 100644 --- a/libcorpus2/tagset.h +++ b/libcorpus2/tagset.h @@ -99,10 +99,10 @@ public: Tagset(); /** - * Tagset convenience constructor, parse a string as if it were the + * Tagset convenience creation function, parse a string as if it were the * contents of a tagset ini file */ - explicit Tagset(const char*); + static Tagset from_data(const char*); /** * Tag parsing -- functional version, whole tag string. -- GitLab