Source: OmPInstructionNode.h
|
|
|
|
#ifndef OM_PINSTRUCTION_NODE_H
#define OM_PINSTRUCTION_NODE_H
/**
* The processing instruction final node structure.
*
* This class provides a specialization of OmFinalNode to implement the ProcessingInstruction node construction.
* This corresponds to a zero-terminated C string of 8 bits characters.
* This is encoded as <? representation ?>
* The list of children must always be empty.
*/
class OmPInstructionNode : public OmFinalNode
{
public:
/**
* Constructor (can be used as default).
* @li Precondition: ~ NullPointer(buffer_in)
*/
explicit OmPInstructionNode(const char * buffer_in="") {
OmException::checkNullPointer(buffer_in);
buffer_ = buffer_in; }
/**
* Get the buffer.
*/
virtual const char * getBuffer() const {
return buffer_.c_str(); }
/**
* Set the buffer.
* @li Precondition: ~ NullPointer(buffer_in)
*/
virtual void setBuffer(const char * buffer_in) {
OmException::checkNullPointer(buffer_in);
buffer_ = buffer_in; }
protected:
/**
* Copy constructor.
*/
OmPInstructionNode(const OmPInstructionNode & other_in)
: OmFinalNode(other_in),
buffer_(other_in.buffer_) {}
/**
* Destructor.
*/
virtual ~OmPInstructionNode() {}
/**
* Implement access to the concrete type.
*/
virtual OmType typeImp() const {
return OmPInstructionType; }
/**
* Implement the deep cloning.
*/
virtual OmNode * cloneImp() const {
return new OmPInstructionNode(*this); }
/**
* Implement the writing to an output device.
*/
virtual void writeImp(OmOutputDevice & output_in) const {
OmException::checkMalformedNode(buffer_.empty(), "OmPInstructionNode cannot be empty");
output_in.writePInstruction(buffer_.c_str()); }
/**
* Implement the reading from an input device.
*/
virtual void readImp(OmInputDevice & input_in) {
unsigned int length;
input_in.readLength(length);
buffer_.resize(length);
input_in.readPInstruction(&buffer_[0], length); }
private:
string buffer_;
};
#endif // OM_PINSTRUCTION_NODE_H
Generated by: root@localhost.localdomain on Tue Oct 12 21:02:30 199. |