TerraLib and TerraView Wiki Page

This is an old revision of the document!


TerraLib → Core Runtime Library

URI

Design

API

class URI
{
  public:
 
// typedefs
    typedef std::string string_type;
    typedef string_type::iterator iterator;
    typedef string_type::const_iterator const_iterator;
    typedef std::iterator_traits<iterator>::value_type value_type;
    typedef boost::iterator_range<const_iterator> const_range_type;
 
// constructors and destructor
    URI();
 
    template <typename InputIter, class Alloc = std::allocator<value_type> >
    URI(const InputIter &first, const InputIter &last, const Alloc &alloc = Alloc());
 
    template <class Source, class Alloc = std::allocator<value_type>>
    explicit URI(const Source& source, const Alloc& alloc = Alloc());
 
    URI(const URI& other);
 
    URI(URI&& other) noexcept;
 
    ~URI();
 
// assignment
    URI& operator=(const URI& other);
 
    URI& operator=(URI&& other) noexcept;
 
// swap
    void swap(URI& other) noexcept;
 
// iterators
    const_iterator begin() const;
 
    const_iterator end() const;
 
    const_range_type scheme_range() const;
 
    const_range_type user_info_range() const;
 
    const_range_type host_range() const;
 
    const_range_type port_range() const;
 
    const_range_type path_range() const;
 
 
    const_range_type query_range() const;
 
    const_range_type fragment_range() const;
 
// accessors
    string_type scheme() const;
    string_type user_info() const;
    string_type host() const;
    string_type port() const;
    string_type path() const;
    string_type authority() const;
    string_type query() const;
    string_type fragment() const;
};

Examples

main.cpp
// TerraLib
#include <terralib/core/URI.h>
 
// STL
#include <cassert>
 
int main()
{
 
  te::core::URI uri("http://www.dpi.inpe.br/terralib5/wiki/doku.php?id=wiki:documentation:devguide#modules");
 
  assert(uri.is_absolute());
  assert(!uri.is_opaque());
  assert(*uri.scheme() == "http");
  assert(*uri.host() == "www.dpi.inpe.br");
  assert(*uri.path() == "/terralib5/wiki/doku.php");
  assert(*uri.query() == "id=wiki:documentation:devguide");
  assert(*uri.fragment() == "modules");
 
  return 0;
}

References

Tickets

  • #270: Refactory URI.
  • #1332: Criar a estrutura de pastas e registro no CMake para a nova versão de URI.
  • #1333: Implementação da API URI.
  • #1334: Implementação de testes para API URI.
  • #1335: Implementar os exemplos da API URI.
  • #1336: Fazer a documentação da API de URIs.

Module Manager