* Made rpc::CommandSlot into a template class and removed

"command_*_slot.{cc,h}".

* Added 'if' command. 


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@971 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-09-02 15:07:37 +00:00
parent ac2f5a8882
commit 1cc1374c7a
23 changed files with 467 additions and 1701 deletions
+29
View File
@@ -89,4 +89,33 @@ TextElementCString::copy_string(char* first, char* last, rpc::target_type target
return first + length;
}
// char*
// TextElementCommand::print(char* first, char* last, Canvas::attributes_list* attributes, rpc::target_type target) {
// Attributes baseAttribute = attributes->back();
// push_attribute(attributes, Attributes(first, m_attributes, Attributes::color_invalid));
// if (first == last)
// return first;
// if (m_flags & flag_escape_hex) {
// char buffer[last - first];
// char* bufferLast = copy_string(buffer, buffer + (last - first), target);
// first = rak::transform_hex(buffer, bufferLast, first, last);
// } else if (m_flags & flag_escape_html) {
// char buffer[last - first];
// char* bufferLast = copy_string(buffer, buffer + (last - first), target);
// first = rak::copy_escape_html(buffer, bufferLast, first, last);
// } else {
// first = copy_string(first, last, target);
// }
// push_attribute(attributes, Attributes(first, baseAttribute));
// return first;
// }
}
+31
View File
@@ -155,6 +155,37 @@ text_element_string_slot(const slot_type& slot,
return new TextElementStringSlot<slot_type>(slot, flags, attributes, length);
}
//
// New TE's for calling commands directly. Move to a better place.
//
class TextElementCommand : public TextElement {
public:
static const int flag_normal = 0;
static const int flag_escape_hex = (1 << 0);
static const int flag_escape_html = (1 << 1);
static const int flag_fixed_width = (1 << 8);
TextElementCommand(const char* command) : m_command(command) {}
int flags() const { return m_flags; }
void set_flags(int flags) { m_flags = flags; }
int attributes() const { return m_attributes; }
void set_attributes(int a) { m_attributes = a; }
virtual char* print(char* first, char* last, Canvas::attributes_list* attributes, rpc::target_type target);
protected:
int m_flags;
int m_attributes;
const char* m_command;
};
}
#endif