MICO Platform
 All Classes Namespaces Functions Variables Friends
Content.hpp
1 #ifndef HAVE_CONTENT_H
2 #define HAVE_CONTENT_H 1
3 
4 #include <string>
5 #include <iostream>
6 
7 
8 namespace mico {
9  namespace rdf {
10  namespace model {
11  class URI;
12  class Value;
13  }
14  }
15 
16  namespace persistence {
17 
18  class ContentItem;
19 
20  class Content
21  {
22  friend bool operator==(Content& c1, Content& c2);
23 
24  protected:
25  ContentItem& item;
26  const std::string baseUrl;
27  std::string id;
28  const std::string& contentDirectory;
29 
30 
31  public:
32  Content(ContentItem& item, const std::string baseUrl, const std::string& contentDirectory, const std::string id) : item(item), baseUrl(baseUrl), id(id), contentDirectory(contentDirectory) {};
33 
34  Content(ContentItem& item, const std::string baseUrl, const std::string& contentDirectory, const mico::rdf::model::URI& uri);
35 
36  virtual ~Content() {};
37 
44 
45 
52  void setType(const std::string type);
53 
58  std::string getType();
59 
60 
64  void setProperty(const mico::rdf::model::URI& property, const std::string value);
65 
66 
70  std::string getProperty(const mico::rdf::model::URI& property);
71 
72 
76  void setRelation(const mico::rdf::model::URI& property, const mico::rdf::model::URI& value);
77 
82 
87  std::ostream* getOutputStream();
88 
93  std::istream* getInputStream();
94 
98  void deleteContent();
99 
100  };
101 
102 
103  inline bool operator==(Content& c1, Content& c2)
104  {
105  return c1.baseUrl == c2.baseUrl && c1.id == c2.id;
106  }
107  }
108 }
109 #endif
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in c...
Definition: http_client.cpp:23
std::istream * getInputStream()
Return a new input stream for reading the content.
Definition: Content.cpp:199
The supertype of all RDF model objects (URIs, blank nodes and literals).
Definition: rdf_model.hpp:27
void deleteContent()
Delete the binary data associated with this content object, if any.
Definition: Content.cpp:204
mico::rdf::model::Value * getRelation(const mico::rdf::model::URI &property)
Return the property value of this content part for the given property.
Definition: Content.cpp:163
void setProperty(const mico::rdf::model::URI &property, const std::string value)
Set the property with the given URI to the given value.
Definition: Content.cpp:107
void setType(const std::string type)
Set the type of this content part using an arbitrary string identifier (e.g.
Definition: Content.cpp:67
const mico::rdf::model::URI getURI()
Return the URI uniquely identifying this content part.
Definition: Content.cpp:56
std::string getProperty(const mico::rdf::model::URI &property)
Return the property value of this content part for the given property.
Definition: Content.cpp:122
Definition: Content.hpp:20
Representation of a ContentItem.
Definition: ContentItem.hpp:76
void setRelation(const mico::rdf::model::URI &property, const mico::rdf::model::URI &value)
Set the property with the given URI to the given value.
Definition: Content.cpp:148
std::string getType()
Return the type of this content part using an arbitrary string identifier (e.g.
Definition: Content.cpp:82
A URI.
Definition: rdf_model.hpp:74
std::ostream * getOutputStream()
Return a new output stream for writing to the content.
Definition: Content.cpp:190