]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decode/decoder.cpp
manual: Add double-quotes around wget URLs.
[pulseview.git] / pv / data / decode / decoder.cpp
index 3769f8898f18fc7736691c4288fde9b175f5c206..9792ace43412ad6d01bb44596d3676641b24f9cc 100644 (file)
@@ -38,7 +38,7 @@ namespace decode {
 
 Decoder::Decoder(const srd_decoder *const dec) :
        srd_decoder_(dec),
-       shown_(true),
+       visible_(true),
        decoder_inst_(nullptr)
 {
        // Query the annotation output classes
@@ -76,9 +76,13 @@ Decoder::Decoder(const srd_decoder *const dec) :
                        ann_classes_.at((size_t)cl->data).row = &(rows_.back());
        }
 
-       if (rows_.empty())
+       if (rows_.empty()) {
                // Make sure there is a row for PDs without row declarations
-               rows_.emplace_back(0, this);
+               rows_.push_back({0, this});
+
+               for (AnnotationClass& c : ann_classes_)
+                       c.row = &(rows_.back());
+       }
 }
 
 Decoder::~Decoder()
@@ -97,14 +101,14 @@ const char* Decoder::name() const
        return srd_decoder_->name;
 }
 
-bool Decoder::shown() const
+bool Decoder::visible() const
 {
-       return shown_;
+       return visible_;
 }
 
-void Decoder::show(bool show)
+void Decoder::set_visible(bool visible)
 {
-       shown_ = show;
+       visible_ = visible;
 }
 
 const vector<DecodeChannel*>& Decoder::channels() const
@@ -242,6 +246,16 @@ vector<const AnnotationClass*> Decoder::ann_classes() const
        return result;
 }
 
+vector<AnnotationClass*> Decoder::ann_classes()
+{
+       vector<AnnotationClass*> result;
+
+       for (AnnotationClass& c : ann_classes_)
+               result.push_back(&c);
+
+       return result;
+}
+
 AnnotationClass* Decoder::get_ann_class_by_id(size_t id)
 {
        if (id >= ann_classes_.size())