Ticket #2086: DigestCode2086.cpp

File DigestCode2086.cpp, 788 bytes (added by shinta, 16 years ago)
Line 
1status_t
2BArchivable::Archive(BMessage* into, bool deep) const
3{
4 if (!into) {
5 // TODO: logging/other error reporting?
6 return B_BAD_VALUE;
7 }
8
9 BString name;
10 Demangle(typeid(*this).name(), name);
11 if ( name == "BPrivate::_BTextInput_" ) {
12 name = "_BTextInput_";
13 }
14
15 return into->AddString(B_CLASS_FIELD, name);
16}
17
18void
19Mangle(const char* name, BString& out)
20{
21// TODO: add support for template classes
22// _find__t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i0PCccUlUl
23
24 // Chop this:
25 // testthree::testfour::Testthree::Testfour
26 // up into little bite-sized pieces
27 int count = 0;
28 string origName(name);
29 vector<string> spacenames;
30
31 if ( origName == "_BTextInput_" ) {
32 origName = "BPrivate::_BTextInput_";
33 }
34}