Beispiel #1
0
    Source& Source::operator<<(std::shared_ptr<Source> src)
    {
        SourceChunkRef new_src = SourceChunkRef(new SourceRef(src));

        append_source_ref(new_src);
        return *this;
    }
Beispiel #2
0
    Source& Source::operator<<(Source& src)
    {
        std::shared_ptr<Source> ref_src = std::shared_ptr<Source>(new Source(src));

        SourceChunkRef new_src = SourceChunkRef(new SourceRef(ref_src));

        append_source_ref(new_src);
        return *this;
    }
Beispiel #3
0
    void Source::append_text_chunk(const std::string& str)
    {
        if (_chunk_list->empty())
        {
            _chunk_list->push_back(SourceChunkRef(new SourceText(str)));
        }
        else
        {
            SourceChunkRef last = *(_chunk_list->rbegin());

            if (last->is_source_text())
            {
                std::shared_ptr<SourceText> text = std::static_pointer_cast<SourceText>(last);
                text->_source += str;
            }
            else
            {
                _chunk_list->push_back(SourceChunkRef(new SourceText(str)));
            }
        }
    }
Beispiel #4
0
    void Source::append_text_chunk(const std::string& str)
    {
        if (_chunk_list->empty())
        {
            _chunk_list->push_back(SourceChunkRef(new SourceText(str)));
        }
        else
        {
            SourceChunkRef last = *(_chunk_list->rbegin());

            if (last->is_source_text())
            {
                RefPtr<SourceText> text = RefPtr<SourceText>::cast_dynamic(last);
                text->_source += str;
            }
            else
            {
                _chunk_list->push_back(SourceChunkRef(new SourceText(str)));
            }
        }
    }
Beispiel #5
0
    Source& Source::append_with_separator(Source& src, const std::string& separator)
    {
        if (!src.all_blanks())
        {
            if (!all_blanks())
            {
                append_text_chunk(separator);
            }
            std::shared_ptr<Source> ref_source = std::shared_ptr<Source>(new Source(src));
            append_source_ref(SourceChunkRef(new SourceRef(ref_source)));
        }

        return (*this);
    }