diff options
Diffstat (limited to 'xml')
-rw-r--r-- | xml/display.c | 6 | ||||
-rw-r--r-- | xml/display.h | 6 | ||||
-rw-r--r-- | xml/function.c | 22 | ||||
-rw-r--r-- | xml/function.h | 2 | ||||
-rw-r--r-- | xml/object.c | 34 | ||||
-rw-r--r-- | xml/object.h | 4 | ||||
-rw-r--r-- | xml/parser.c | 14 | ||||
-rw-r--r-- | xml/parser.h | 2 | ||||
-rw-r--r-- | xml/skin.c | 8 | ||||
-rw-r--r-- | xml/skin.h | 8 | ||||
-rw-r--r-- | xml/string.c | 40 | ||||
-rw-r--r-- | xml/string.h | 4 | ||||
-rw-r--r-- | xml/xml.c | 8 |
13 files changed, 79 insertions, 79 deletions
diff --git a/xml/display.c b/xml/display.c index ae4ffa4..9023a9f 100644 --- a/xml/display.c +++ b/xml/display.c @@ -2,8 +2,8 @@ #include "xml/display.h" -static const std::string DisplayNames[] = - { "channelInfo", "channelSmall", "volume", "audioTracks", "message", "replayInfo", +static const std::string DisplayNames[] = + { "channelInfo", "channelSmall", "volume", "audioTracks", "message", "replayInfo", "replaySmall", "menu" }; cxDisplay::cxDisplay(cxSkin *parent): @@ -14,7 +14,7 @@ cxDisplay::cxDisplay(cxSkin *parent): { } -bool cxDisplay::ParseType(const std::string &Text) +bool cxDisplay::ParseType(const std::string &Text) { for (int i = 0; i < (int)__COUNT_DISPLAY__; ++i) { if (DisplayNames[i].length() > 0 && DisplayNames[i] == Text) { diff --git a/xml/display.h b/xml/display.h index 6316adc..796518f 100644 --- a/xml/display.h +++ b/xml/display.h @@ -1,7 +1,7 @@ // -*- c++ -*- -#ifndef VDR_TEXT2SKIN_DISPLAY_H -#define VDR_TEXT2SKIN_DISPLAY_H +#ifndef VDR_TEXT2SKIN_DISPLAY_H +#define VDR_TEXT2SKIN_DISPLAY_H #include "xml/object.h" #include <string> @@ -56,4 +56,4 @@ public: ~cxDisplays(); }; -#endif // VDR_TEXT2SKIN_DISPLAY_H +#endif // VDR_TEXT2SKIN_DISPLAY_H diff --git a/xml/function.c b/xml/function.c index 62c097f..9ee07fc 100644 --- a/xml/function.c +++ b/xml/function.c @@ -17,7 +17,7 @@ cxFunction::cxFunction(cxObject *Parent): mType(string), mString(mObject, false), mNumber(0), - mNumParams(0) + mNumParams(0) { } @@ -49,7 +49,7 @@ cxFunction::~cxFunction() delete mParams[i]; } -bool cxFunction::Parse(const std::string &Text) +bool cxFunction::Parse(const std::string &Text) { const char *text = Text.c_str(); const char *ptr = text, *last = text; @@ -58,7 +58,7 @@ bool cxFunction::Parse(const std::string &Text) if (*ptr == '\'' || *ptr == '{') { // must be string - if (strlen(ptr) < 2 + if (strlen(ptr) < 2 || (*ptr == '\'' && *(ptr + strlen(ptr) - 1) != '\'') || (*ptr == '{' && *(ptr + strlen(ptr) - 1) != '}')) { esyslog("ERROR: Unmatched string end\n"); @@ -100,7 +100,7 @@ bool cxFunction::Parse(const std::string &Text) if (inExpr++ == 0) { int i; for (i = 0; Internals[i] != NULL; ++i) { - if ((size_t)(ptr - last) == strlen(Internals[i]) + if ((size_t)(ptr - last) == strlen(Internals[i]) && memcmp(last, Internals[i], ptr - last) == 0){ type = (eType)(INTERNAL + 1 + i); break; @@ -143,11 +143,11 @@ bool cxFunction::Parse(const std::string &Text) int params = 0; switch (mType) { - case fun_and: + case fun_and: case fun_or: params = -1; break; - case fun_eq: - case fun_ne: + case fun_eq: + case fun_ne: case fun_gt: case fun_lt: case fun_ge: @@ -160,7 +160,7 @@ bool cxFunction::Parse(const std::string &Text) } if (params != -1 && mNumParams != (uint)params) { - esyslog("ERROR: Text2Skin: Wrong number of parameters to %s, " + esyslog("ERROR: Text2Skin: Wrong number of parameters to %s, " "expecting %d", Internals[mType - 1 - INTERNAL], params); return false; } @@ -176,7 +176,7 @@ bool cxFunction::Parse(const std::string &Text) return false; } } - + return true; } @@ -184,7 +184,7 @@ cxType cxFunction::FunFile(const cxType &Param) const { std::string path = cText2SkinRender::ImagePath(Param); //Dprintf("checking file(%s) in cache\n", path.c_str()); - return cText2SkinBitmap::Available(path, mObject->Alpha(), + return cText2SkinBitmap::Available(path, mObject->Alpha(), mObject->Size().h > 1 ? mObject->Size().h : 0, mObject->Size().w > 1 ? mObject->Size().w : 0, mObject->Colors()) @@ -254,7 +254,7 @@ cxType cxFunction::Evaluate(void) const case fun_trans: return mSkin->Translate(mParams[0]->Evaluate()); - + case fun_plugin: return FunPlugin(mParams[0]->Evaluate()); diff --git a/xml/function.h b/xml/function.h index 889b1e0..d50ddad 100644 --- a/xml/function.h +++ b/xml/function.h @@ -45,7 +45,7 @@ private: int mNumber; cxFunction *mParams[MAXPARAMETERS]; uint mNumParams; - + protected: cxType FunFile (const cxType &Param) const; cxType FunPlugin(const cxType &Param) const; diff --git a/xml/object.c b/xml/object.c index 02fc3fc..8b3d5d2 100644 --- a/xml/object.c +++ b/xml/object.c @@ -5,7 +5,7 @@ #include "font.h" static const std::string ObjectNames[] = - { "image", "text", "marquee", "blink", "rectangle", "ellipse", "slope", "progress", + { "image", "text", "marquee", "blink", "rectangle", "ellipse", "slope", "progress", "scrolltext", "scrollbar", "block", "list", "item" }; cxObject::cxObject(cxDisplay *Parent): @@ -72,13 +72,13 @@ cxObject::cxObject(const cxObject &Src): mObjects = new cxObjects(*Src.mObjects); } -cxObject::~cxObject() +cxObject::~cxObject() { delete mCondition; delete mObjects; } -bool cxObject::ParseType(const std::string &Text) +bool cxObject::ParseType(const std::string &Text) { for (int i = 0; i < (int)__COUNT_OBJECT__; ++i) { if (ObjectNames[i] == Text) { @@ -89,7 +89,7 @@ bool cxObject::ParseType(const std::string &Text) return false; } -bool cxObject::ParseCondition(const std::string &Text) +bool cxObject::ParseCondition(const std::string &Text) { cxFunction *result = new cxFunction(this); if (result->Parse(Text)) { @@ -100,28 +100,28 @@ bool cxObject::ParseCondition(const std::string &Text) return false; } -bool cxObject::ParseAlignment(const std::string &Text) +bool cxObject::ParseAlignment(const std::string &Text) { if (Text == "center") mAlign = (eTextAlignment)(taTop | taCenter); else if (Text == "right") mAlign = (eTextAlignment)(taTop | taRight); else if (Text == "left") mAlign = (eTextAlignment)(taTop | taLeft); - else + else return false; return true; } -bool cxObject::ParseFontFace(const std::string &Text) +bool cxObject::ParseFontFace(const std::string &Text) { int size = 0, width = 0, pos; std::string face = Text; if ((pos = face.find('@')) != -1) { std::string s = face.substr(pos + 1); - const char *p = s.c_str(); + const char *p = s.c_str(); char *end; size = strtol(p, &end, 10); if (*end == ',') width = strtol(end + 1, NULL, 10); - + face.erase(pos); } @@ -141,7 +141,7 @@ void cxObject::SetListIndex(uint Index, int Tab) mCondition->SetListIndex(Index, Tab); } -const std::string &cxObject::TypeName(void) const +const std::string &cxObject::TypeName(void) const { return ObjectNames[mType]; } @@ -192,13 +192,13 @@ txSize cxObject::Size(const txPoint &BaseOffset, const txSize &BaseSize, const t return txSize(p2.x - p1.x + 1, p2.y - p1.y + 1); } -const tColor *cxObject::Fg(void) const +const tColor *cxObject::Fg(void) const { static tColor Fg; return cText2SkinRender::ItemColor(mFg, Fg) ? &Fg : NULL; } -const tColor *cxObject::Bg(void) const +const tColor *cxObject::Bg(void) const { static tColor Bg; return cText2SkinRender::ItemColor(mBg, Bg) ? &Bg : NULL; @@ -210,25 +210,25 @@ const tColor *cxObject::Bl(void) const return cText2SkinRender::ItemColor(mBl, Bl) ? &Bl : NULL; } -const tColor *cxObject::Mask(void) const +const tColor *cxObject::Mask(void) const { static tColor Mask; return cText2SkinRender::ItemColor(mMask, Mask) ? &Mask : NULL; } -const tColor *cxObject::Mark(void) const +const tColor *cxObject::Mark(void) const { static tColor Mark; return cText2SkinRender::ItemColor(mMark, Mark) ? &Mark : NULL; } -const tColor *cxObject::Active(void) const +const tColor *cxObject::Active(void) const { static tColor Active; return cText2SkinRender::ItemColor(mActive, Active) ? &Active : NULL; } -const tColor *cxObject::Keep(void) const +const tColor *cxObject::Keep(void) const { static tColor Keep; return cText2SkinRender::ItemColor(mKeep, Keep) ? &Keep : NULL; @@ -238,7 +238,7 @@ cxObjects::cxObjects(void) { } -cxObjects::~cxObjects() +cxObjects::~cxObjects() { for (uint i = 0; i < size(); ++i) delete operator[](i); diff --git a/xml/object.h b/xml/object.h index 2343f82..297039e 100644 --- a/xml/object.h +++ b/xml/object.h @@ -27,7 +27,7 @@ struct txWindow { txPoint pos1; txPoint pos2; int bpp; - txWindow(int _x1 = 0, int _y1 = 0, int _x2 = -1, int _y2 = -1, int _bpp=4): + txWindow(int _x1 = 0, int _y1 = 0, int _x2 = -1, int _y2 = -1, int _bpp=4): pos1(_x1, _y2), pos2(_x2, _y2), bpp(_bpp) {} }; @@ -103,7 +103,7 @@ public: item, #define __COUNT_OBJECT__ (item + 1) }; - + private: cxDisplay *mDisplay; cxSkin *mSkin; diff --git a/xml/parser.c b/xml/parser.c index 8329fb6..ed2e72b 100644 --- a/xml/parser.c +++ b/xml/parser.c @@ -51,7 +51,7 @@ } else \ _target = _l; \ } - + #define ATTRIB_MAN_NUMBER(_attr,_target) \ ATTRIB_OPT_NUMBER(_attr,_target) \ else { \ @@ -92,7 +92,7 @@ bool xStartElem(const std::string &name, std::map<std::string,std::string> &attr ATTRIB_MAN_FUNC ("version", skin->mVersion.Parse); ATTRIB_MAN_STRING("name", skin->mTitle); ATTRIB_MAN_FUNC ("screenBase", skin->ParseBase); - } + } else TAG_ERR_REMAIN("document"); } @@ -164,7 +164,7 @@ bool xStartElem(const std::string &name, std::map<std::string,std::string> &attr if (name == "blink") { ATTRIB_OPT_STRING("blinkColor", object->mBl); ATTRIB_OPT_NUMBER("delay", object->mDelay); - + if (object->mDelay == 0) object->mDelay = 1000; } @@ -182,7 +182,7 @@ bool xStartElem(const std::string &name, std::map<std::string,std::string> &attr ATTRIB_OPT_STRING("color", object->mFg); ATTRIB_OPT_NUMBER("arc", object->mArc); } - else if (name == "progress" + else if (name == "progress" || name == "scrollbar") { ATTRIB_OPT_STRING("color", object->mFg); ATTRIB_OPT_STRING("bgColor", object->mBg); @@ -204,7 +204,7 @@ bool xStartElem(const std::string &name, std::map<std::string,std::string> &attr } else TAG_ERR_REMAIN(context[context.size() - 1].c_str()); } - } else + } else TAG_ERR_CHILD(context[context.size() - 1].c_str()); context.push_back(name); return true; @@ -220,7 +220,7 @@ bool xCharData(const std::string &text) { while (text[end] == '\012' || text[end] == '\015' || text[end] == ' ' || text[end] == '\t') --end; - + //Dprintf("char data after: %s\n", text.substr(start, end - start + 1).c_str()); if (end - start + 1 > 0) { @@ -320,4 +320,4 @@ cxSkin *xmlParse(const std::string &name, const std::string &fileName, cText2Ski skin = NULL; return result; } - + diff --git a/xml/parser.h b/xml/parser.h index c8b8eb7..85e2576 100644 --- a/xml/parser.h +++ b/xml/parser.h @@ -11,5 +11,5 @@ class cText2SkinTheme; cxSkin *xmlParse(const std::string &name, const std::string &fileName, cText2SkinI18n *I18n, cText2SkinTheme *Theme); - + #endif // VDR_TEXT2SKIN_PARSER_H @@ -41,11 +41,11 @@ bool cxVersion::Parse(const std::string &Text) cxSkin::cxSkin(const std::string &Name, cText2SkinI18n *I18n, cText2SkinTheme *Theme): mName(Name), mI18n(I18n), - mTheme(Theme) + mTheme(Theme) { } -void cxSkin::SetBase(eScreenBase Base) +void cxSkin::SetBase(eScreenBase Base) { if (Base != (eScreenBase)-1) mBase = Base; @@ -76,7 +76,7 @@ void cxSkin::SetBase(eScreenBase Base) } } -bool cxSkin::ParseBase(const std::string &Text) +bool cxSkin::ParseBase(const std::string &Text) { int i; for (i = 0; i < (int)__COUNT_BASE__; ++i) { @@ -89,7 +89,7 @@ bool cxSkin::ParseBase(const std::string &Text) } return false; } - + std::string cxSkin::Translate(const std::string &Text) { if (mI18n != NULL) @@ -1,7 +1,7 @@ // -*- c++ -*- -#ifndef VDR_TEXT2SKIN_XML_SKIN_H -#define VDR_TEXT2SKIN_XML_SKIN_H +#ifndef VDR_TEXT2SKIN_XML_SKIN_H +#define VDR_TEXT2SKIN_XML_SKIN_H #include "xml/display.h" #include <vdr/osd.h> @@ -77,7 +77,7 @@ private: cxVersion mVersion; cxDisplays mDisplays; - + cText2SkinI18n *mI18n; // TODO: should move here completely cText2SkinTheme *mTheme; @@ -106,4 +106,4 @@ inline cxDisplay *cxSkin::Get(cxDisplay::eType Type) { return NULL; } -#endif // VDR_TEXT2SKIN_XML_SKIN_H +#endif // VDR_TEXT2SKIN_XML_SKIN_H diff --git a/xml/string.c b/xml/string.c index dda65bb..6504f64 100644 --- a/xml/string.c +++ b/xml/string.c @@ -7,57 +7,57 @@ static const char *Tokens[__COUNT_TOKEN__] = { "DateTime", "FreeDiskSpace", "UsedDiskSpace", "TotalDiskSpace", "VideoSizeWidth", "VideoSizeHeight", "AudioTrack", "AudioChannel", // Channel Display - "ChannelNumber", "ChannelName", "ChannelShortName", "ChannelBouquet", "ChannelPortal", - "ChannelSource", "ChannelID", "PresentStartDateTime", "PresentVPSDateTime", + "ChannelNumber", "ChannelName", "ChannelShortName", "ChannelBouquet", "ChannelPortal", + "ChannelSource", "ChannelID", "PresentStartDateTime", "PresentVPSDateTime", "CurrentEventsTitle1", "CurrentEventsStartDateTime1", "CurrentEventsStopDateTime1", "CurrentEventsChannelNumber1", "CurrentEventsChannelName1", "CurrentEventsIsRecording1", "CurrentEventsTitle2", "CurrentEventsStartDateTime2", "CurrentEventsStopDateTime2", "CurrentEventsChannelNumber2", "CurrentEventsChannelName2", "CurrentEventsIsRecording2", "CurrentEventsTitle3", "CurrentEventsStartDateTime3", "CurrentEventsStopDateTime3", "CurrentEventsChannelNumber3", "CurrentEventsChannelName3", "CurrentEventsIsRecording3", "TimerConflicts", "PresentEndDateTime", "PresentDuration", "PresentProgress", "PresentRemaining", "PresentLanguageCode", "PresentLanguageDescription", "PresentVideoAR", "PresentEventID", - "PresentTitle", "PresentShortText", "PresentDescription", "FollowingStartDateTime", + "PresentTitle", "PresentShortText", "PresentDescription", "FollowingStartDateTime", "FollowingVPSDateTime", "FollowingEndDateTime", "FollowingDuration", "FollowingTitle", "FollowingShortText", "FollowingDescription", "Language", - "HasTeletext", "ChannelHasTeletext", "HasMultilang", "ChannelHasMultilang", "HasDolby", + "HasTeletext", "ChannelHasTeletext", "HasMultilang", "ChannelHasMultilang", "HasDolby", "ChannelHasDolby", "IsEncrypted", "ChannelIsEncrypted", "IsRadio", "ChannelIsRadio", "IsRecording", "CurrentRecording", "HasVPS", "HasTimer", "IsRunning", "ChannelHasVPS", - "PresentHasTimer", "PresentIsRunning", "PresentHasVPS", "FollowingHasTimer", + "PresentHasTimer", "PresentIsRunning", "PresentHasVPS", "FollowingHasTimer", "FollowingIsRunning", "FollowingHasVPS", - + // Volume Display "VolumeCurrent", "VolumeTotal", "IsMute", "VolumeIsMute", - + // Message Display "Message", "MessageStatus", "MessageInfo", "MessageWarning", "MessageError", - + // Replay Display - "ReplayTitle", "ReplayPositionIndex", "ReplayDurationIndex", "ReplayPrompt", + "ReplayTitle", "ReplayPositionIndex", "ReplayDurationIndex", "ReplayPrompt", "ReplayName", "ReplayDateTime", "ReplayShortText", "ReplayDescription", "ReplayLanguageCode", "ReplayLanguageDescription", "ReplayVideoAR", - "IsPlaying", "ReplayIsPlaying", "IsFastForward", "ReplayIsFastForward", "IsFastRewind", - "ReplayIsFastRewind", "IsSlowForward", "ReplayIsSlowForward", "IsSlowRewind", + "IsPlaying", "ReplayIsPlaying", "IsFastForward", "ReplayIsFastForward", "IsFastRewind", + "ReplayIsFastRewind", "IsSlowForward", "ReplayIsSlowForward", "IsSlowRewind", "ReplayIsSlowRewind", "IsPausing", "ReplayIsPausing", "ReplayPosition", "ReplayDuration", "ReplayRemaining", "ReplayMode", "ReplayIsShuffle", "ReplayIsLoop", // Menu Page - "MenuTitle", "MenuGroup", "IsMenuGroup", "MenuItem", "IsMenuItem", "MenuCurrent", + "MenuTitle", "MenuGroup", "IsMenuGroup", "MenuItem", "IsMenuItem", "MenuCurrent", "IsMenuCurrent", "MenuText", "RecordingName", "RecordingFilename", "RecordingDateTime", "RecordingTitle", "RecordingShortText", "RecordingDescription", "RecordingLanguageCode", "FrontendSTR", "FrontendSNR", "FrontendHasLock", "FrontendHasSignal", "RecordingPriority", "RecordingLifetime", "RecordingVideoAR", "RecordingSize", "RecordingLength", "RecordingCuttedLength", "OsdWidth", "OsdHeight", - "RecordingLanguageDescription", "ButtonRed", "ButtonGreen", + "RecordingLanguageDescription", "ButtonRed", "ButtonGreen", "ButtonYellow", "ButtonBlue", "CanScrollUp", "CanScrollDown" }; -std::string txToken::Token(const txToken &Token) +std::string txToken::Token(const txToken &Token) { std::string result = (std::string)"{" + Tokens[Token.Type]; //if (Token.Attrib.length() > 0) // result += ":" + Token.Attrib; result += "}"; - + return result; } @@ -91,7 +91,7 @@ void cxString::Reparse(void) } } -bool cxString::Parse(const std::string &Text, bool Translate) +bool cxString::Parse(const std::string &Text, bool Translate) { std::string trans = Translate ? mSkin->Translate(Text) : Text; const char *text = trans.c_str(); @@ -114,7 +114,7 @@ bool cxString::Parse(const std::string &Text, bool Translate) ++ptr; continue; - } + } else if (*ptr == '{') { if (inToken) { esyslog("ERROR: Unexpected '{' in token"); @@ -165,14 +165,14 @@ bool cxString::Parse(const std::string &Text, bool Translate) lastToken.Attrib = n; } else lastToken.Attrib = attr; - } + } inAttrib = false; inToken = false; } else { int i; for (i = 0; i < (int)__COUNT_TOKEN__; ++i) { - if ((size_t)(ptr - last) == strlen(Tokens[i]) + if ((size_t)(ptr - last) == strlen(Tokens[i]) && memcmp(last, Tokens[i], ptr - last) == 0) { txToken token((exToken)i, offset, ""); mTokens.push_back(token); @@ -209,7 +209,7 @@ bool cxString::Parse(const std::string &Text, bool Translate) return true; } -cxType cxString::Evaluate(void) const +cxType cxString::Evaluate(void) const { std::string result; int offset = 0; diff --git a/xml/string.h b/xml/string.h index 2bc1388..9b0d66d 100644 --- a/xml/string.h +++ b/xml/string.h @@ -225,7 +225,7 @@ struct txToken { int Tab; txToken(void): Index(-1), Tab(-1) {} - txToken(exToken t, uint o, const std::string &a): + txToken(exToken t, uint o, const std::string &a): Type(t), Offset(o), Attrib(a), Index(-1), Tab(-1) {} friend bool operator< (const txToken &A, const txToken &B); @@ -233,7 +233,7 @@ struct txToken { static std::string Token(const txToken &Token); }; -inline bool operator< (const txToken &A, const txToken &B) +inline bool operator< (const txToken &A, const txToken &B) { return A.Type == B.Type ? A.Attrib == B.Attrib @@ -176,7 +176,7 @@ XML::readChar(int c) { if (isTokenChar(0, c)) { tag += c; } else if (c == '>') { - if (nodestartcb) + if (nodestartcb) if (!nodestartcb(tag, attr)) return (-1); state = LOOK4START; @@ -215,7 +215,7 @@ XML::readChar(int c) { // looking for attr name, > or / case LOOK4ATTRN: if (c == '>') { - if (nodestartcb) + if (nodestartcb) if (!nodestartcb(tag, attr)) return (-1); state = LOOK4START; @@ -236,7 +236,7 @@ XML::readChar(int c) { // saw / in element opening case SAWSLASH: if (c == '>') { - if (nodestartcb) + if (nodestartcb) if (!nodestartcb(tag, attr)) return (-1); if (nodeendcb) @@ -307,7 +307,7 @@ XML::readChar(int c) { if (isTokenChar(0, c)) { tag += c; } else if (c == '>') { - if (nodeendcb) + if (nodeendcb) if (!nodeendcb(tag)) return false; state = LOOK4START; |