diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f337a4b4b1dfc969b06982a3bcbaf51a2ed2f79..c44aa9a972a3a068053146af5967feb2523ea2ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ PROJECT(Corpus2Library) set(corpus2_ver_major "1") -set(corpus2_ver_minor "2") -set(corpus2_ver_patch "3") +set(corpus2_ver_minor "3") +set(corpus2_ver_patch "0") cmake_minimum_required(VERSION 2.8.0) diff --git a/libcorpus2/ann/annotatedsentence.h b/libcorpus2/ann/annotatedsentence.h index 65b3a0353d94266b6e18edf0054497881e77a72d..1b3a3359ecc98f1f7145b970ebcf862abc90dcc0 100644 --- a/libcorpus2/ann/annotatedsentence.h +++ b/libcorpus2/ann/annotatedsentence.h @@ -125,6 +125,14 @@ public: return true; } + /** + * Remove channel having a given name. Returns whether removed + * (will return false if no channel of the given name exists). + */ + bool remove_channel(const std::string& name) { + return (channels_.erase(name) > 0); + } + const chan_map_t& all_channels() const { return channels_; } diff --git a/swig/annotatedsentence.i b/swig/annotatedsentence.i index c158c4aa603da845d80a225b89233845ccd080e9..f3d2b4e407e1a41a348904550539477e05a58207 100644 --- a/swig/annotatedsentence.i +++ b/swig/annotatedsentence.i @@ -50,6 +50,12 @@ namespace Corpus2 { AnnotationChannel& get_channel(const std::string& name); const AnnotationChannel& get_channel(const std::string& name) const; bool add_channel(const std::string& name, const AnnotationChannel& chan); + + /* Use with care. Note that get_channel returns a reference to the original + channel, hence it is strongly recommended to del the channel ref object + before attempting to call remove_channel. */ + bool remove_channel(const std::string& name); + const chan_map_t& all_channels() const; /* --------------------------------------------------------------------- */