Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 8390 → Rev 8389

/branches/Version13x/Scribus/scribus/desaxe/uniqueid.cpp
42,4 → 42,4
{
if (level == 0)
SaxFilter::chars(text);
}
}
/branches/Version13x/Scribus/scribus/desaxe/saxiohelper.cpp
10,44 → 10,6
const Xml_string SaxIO::saxxDefaultElem("");
 
 
 
Xml_string mkXMLName(QString any)
{
QString result("");
for (unsigned int i=0; i < any.length(); ++i)
{
unsigned int ch = any[i].unicode();
if (ch == ':' || ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')
|| (0xC0 <= ch && ch <= 0xD6) || (0xD8 <= ch && ch <= 0xF6)
|| (0xF8 <= ch && ch <= 0x2FF) || (0x370 <= ch && ch <= 0x37D)
|| (0x37F <= ch && ch <= 0x1FFF) || (0x200C <= ch && ch <= 0x200D)
|| (0x2070 <= ch && ch <= 0x218F) || (0x2C00 <= ch && ch <= 0x2FEF)
|| (0x3001 <= ch && ch <= 0xD7FF) || (0xF900 <= ch && ch <= 0xFDCF)
|| (0xFDF0 <= ch && ch <= 0xFFFD) || ch > 0xFFFF
|| (i > 0 && (ch == '-' || ch == '.' || ('0' <= ch && ch <= '9') || ch == 0xB7
|| (0x300 <= ch && ch <= 0x36F) || (0x203F <= ch && ch <= 0x2040) )))
{
result += ch;
}
else
{
result += '_';
result += ('0' + ch >> 12 & 15);
result += ('0' + ch >> 8 & 15);
result += ('0' + ch >> 4 & 15);
result += ('0' + ch & 15);
}
}
return result;
}
 
/*
NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D]
| [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
*/
 
 
// FIXME: this is too Qt dependent
Xml_string toXMLString(unsigned int val)
{
/branches/Version13x/Scribus/scribus/desaxe/saxiohelper.h
35,10 → 35,6
QValueList<int> parseIntList(Xml_string str);
QValueStack<int> parseIntStack(Xml_string str);
 
 
Xml_string mkXMLName(QString any);
 
 
template<class ENUM>
inline
ENUM parseEnum(Xml_string str)
/branches/Version13x/Scribus/scribus/desaxe/digester.h
30,8 → 30,7
class Action;
class RuleState;
 
 
namespace PRIVATE {
namespace { // ANON
class VarPtr
{
86,7 → 85,7
};
 
 
} // namespace PRIVATE
} // namespace ANON
 
 
 
157,16 → 156,16
RuleState*
state;
std::vector<PRIVATE::VarPtr>
std::vector<VarPtr>
objects;
std::map<Xml_string, PRIVATE::VarPtr>
std::map<Xml_string, VarPtr>
storage;
 
std::map<Xml_string, PRIVATE::Patch*>
std::map<Xml_string, Patch*>
patches;
PRIVATE::VarPtr
VarPtr
result_;
std::vector<Xml_string>
184,7 → 183,7
#endif
unsigned int count = objects.size();
assert (offset < count);
PRIVATE::chkcell<ObjType>(objects[count - offset - 1], &objects);
chkcell<ObjType>(objects[count - offset - 1], &objects);
#ifdef DESAXE_DEBUG
std::cerr << "stack-> " << static_cast<ObjType*>(objects[count - offset - 1].ptr) << "\n";
#endif
202,7 → 201,7
#endif
unsigned int count = objects.size();
assert (offset < count);
PRIVATE::chkcell<ObjType> (objects[offset]);
chkcell<ObjType> (objects[offset]);
return static_cast<ObjType*>(objects[offset].ptr);
}
 
228,7 → 227,7
#ifdef DESAXE_DEBUG
std::cerr << res << " ->result\n";
#endif
result_ = PRIVATE::mkcell(res);
result_ = mkcell(res);
}
 
 
256,13 → 255,13
#ifdef DESAXE_DEBUG
std::cerr << "stack<- " << obj << "\n";
#endif
objects.push_back(PRIVATE::mkcell(obj));
objects.push_back(mkcell(obj));
}
 
 
// now lookup / store / patch business
 
namespace PRIVATE {
namespace {
template <class LinkType>
struct Patch1 : public Patch
295,7 → 294,6
};
inline
void runPatches(Patch*& list, VarPtr link)
{
while (list)
307,7 → 305,7
}
}
inline
void deletePatches(std::map<Xml_string, Patch*>& patches)
{
std::map<Xml_string, Patch*>::iterator it;
328,7 → 326,7
// template<> class Patch1<void>;
// template<> class Patch2<VarPtr,void>;
} //namespace PRIVATE
} //namespace ANON
 
 
 
336,8 → 334,6
inline
ObjType* Digester::lookup(const Xml_string idref)
{
using namespace PRIVATE;
 
std::map<Xml_string, VarPtr>::iterator cell = storage.find(idref);
if (cell == storage.end())
{
361,8 → 357,7
template<class ObjType>
inline
void Digester::store(const Xml_string idref, ObjType* obj)
{
using namespace PRIVATE;
{
#ifdef DESAXE_DEBUG
std::cerr << "store[" << idref << "] <- " << obj << "\n";
#endif
375,8 → 370,6
template<class LinkType>
void Digester::patchCall(const Xml_string idref, void (*fun)(LinkType*) )
{
using namespace PRIVATE;
std::map<Xml_string, VarPtr>::iterator cell = storage.find(idref);
if (cell == storage.end())
{
392,8 → 385,6
template<class ObjType, class LinkType>
void Digester::patchInvoke(const Xml_string idref, ObjType* obj, void (ObjType::*fun)(LinkType*) )
{
using namespace PRIVATE;
std::map<Xml_string, VarPtr>::iterator cell = storage.find(idref);
if (cell == storage.end())
{
/branches/Version13x/Scribus/scribus/styles/charstyle.cpp
263,7 → 263,7
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
if (!name().isEmpty())
att["id"] = mkXMLName(elemtag + name());
att["id"] = elemtag + toXMLString((unsigned long)(this));
handler.begin(elemtag, att);
if (hasParent() && parentStyle())
parentStyle()->saxx(handler);
/branches/Version13x/Scribus/scribus/styles/linestyle.cpp
180,7 → 180,7
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
if (!name().isEmpty())
att["id"] = mkXMLName(elemtag + name());
att["id"] = elemtag + (unsigned long long)(this);
handler.begin(elemtag, att);
if (parentStyle())
parentStyle()->saxx(handler);
/branches/Version13x/Scribus/scribus/styles/paragraphstyle.cpp
219,7 → 219,7
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
if (!name().isEmpty())
att["id"] = mkXMLName(elemtag + name());
att["id"] = elemtag + toXMLString((unsigned long)(this));
handler.begin(elemtag, att);
if (parentStyle() && hasParent())
parentStyle()->saxx(handler);