[sword-svn] r228 - trunk/src/SlideBible
kalemas at crosswire.org
kalemas at crosswire.org
Mon Mar 8 14:45:26 MST 2010
Author: kalemas
Date: 2010-03-08 14:45:26 -0700 (Mon, 08 Mar 2010)
New Revision: 228
Removed:
trunk/src/SlideBible/sbCollection.cpp
trunk/src/SlideBible/sbCollection.h
trunk/src/SlideBible/sbCross.h
trunk/src/SlideBible/sbObject.h
Log:
...
Deleted: trunk/src/SlideBible/sbCollection.cpp
===================================================================
--- trunk/src/SlideBible/sbCollection.cpp 2010-03-08 21:37:47 UTC (rev 227)
+++ trunk/src/SlideBible/sbCollection.cpp 2010-03-08 21:45:26 UTC (rev 228)
@@ -1,123 +0,0 @@
-/*************************************************************************
- * sbVerses.cpp - collection verses contain information
- *
- * author: Konstantin Maslyuk "Kalemas" mailto:kalemas at mail.ru
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- ************************************************************************/
-
-#include "sbCollection.h"
-#include <swconfig.h>
-#include <utilxml.h>
-#include "sbCore.h"
-
-#define VERSION 0.01f
-
-sbCollection::sbCollection()
-{
- version = VERSION;
-}
-
-sbCollection::~sbCollection()
-{
- ;
-}
-
-sbCollection::item * sbCollection::add ( sword::VerseKey * verse )
-{
- int id = find (verse->getShortText());
-
- if ( id <= 0 )
- {
- time_t now; time(&now);
-
- data.push_back (sbCollection::item());
-
- strcpy ( data.back().verse, verse->getShortText() );
-
- data.back().created = now;
- data.back().visited = data.back().created;
- data.back().custom = 0;
- data.back().visits = 0;
-
- return & data.back();
- }
- else
- return & data[id];
-
- return NULL;
-}
-
-int sbCollection::find ( const char * short_key_text , const char * range_end )
-{
- return 0;
-}
-
-void sbCollection::save ( const char * filename, const char * section )
-{
- sword::SWConfig config (filename);
-
- config.Load();
-
- char text [8];
-
- _itoa ( data.size(), text, 10 );
- config [section]["Size"] = text;
-
- _snprintf (text,8,"%f", version);
- config [section]["Version"] = text;
-
- for (int i=0; i < data.size(); i++)
- {
- char line [4]; sprintf (line,"%02i",i);
-
- char buf [256];
-
- _snprintf (buf,256,"<item key=\"%s\" created=\"%i\" visited=\"%i\" visits=\"%i\" custom=\"%i\">", data[i].verse, data[i].created, data[i].visited, data[i].visits, data[i].custom);
-
- sbAssert ( strlen(buf) >= 254 );
-
- config [section][line] = buf;
- }
-
- config.Save();
-}
-
-void sbCollection::load (const char* filename, const char* section)
-{
- sword::SWConfig config (filename);
- config.Load();
-
- const int size = atoi (config[section].getWithDefault("Size","0"));
- const float config_version = atof (config[section].getWithDefault("Version","0.0"));
-
- if ( config_version != VERSION )
- {
- sbAssert ( "Wrong collection version" );
- }
- else
- {
- for (int i=0; i < size; i++)
- {
- char line[4]; sprintf(line,"%02i",i);
-
- sword::XMLTag tag (config[section][line]);
-
- data.push_back (sbCollection::item());
-
- strcpy ( data.back().verse, tag.getAttribute("key") );
-
- data.back().created = atol(tag.getAttribute("created"));
- data.back().visited = atol(tag.getAttribute("visited"));
- data.back().visits = atoi(tag.getAttribute("visits"));
- data.back().custom = atol(tag.getAttribute("custom"));
- }
- }
-}
Deleted: trunk/src/SlideBible/sbCollection.h
===================================================================
--- trunk/src/SlideBible/sbCollection.h 2010-03-08 21:37:47 UTC (rev 227)
+++ trunk/src/SlideBible/sbCollection.h 2010-03-08 21:45:26 UTC (rev 228)
@@ -1,61 +0,0 @@
-/*************************************************************************
- * sbCollection.h - collection of verses contain different information
- *
- * author: Konstantin Maslyuk "Kalemas" mailto:kalemas at mail.ru
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- ************************************************************************/
-
-// TODO rename to sbVellection
-// TODO does Verse Collections need versification?
-
-#ifndef SBCOLLECTION_H
-#define SBCOLLECTION_H
-
-#include <vector>
-#include <versekey.h>
-
-#include "sbBase.h"
-
-class sbCollection
-{
-public:
- sbCollection();
- ~sbCollection();
-
- struct item
- {
- time_t created;
- time_t visited;
- unsigned char visits;
-
- unsigned long custom;
-
- char verse [16];
- };
-
- sbCollection::item * add ( sword::VerseKey * verse );
- void remove ( int id );
- int size ( ) const { return data.size(); }
- int find ( const char * short_key_text , const char * range_end = NULL );
- void sort ( const char * type );
- sbCollection::item & get ( const int pos ) { return data[pos]; }
-
- sbCollection::item & operator [] ( const int pos ) { return data[pos]; }
-
- void load ( const char* filename, const char* section );
- void save ( const char* filename, const char* section );
-
-private:
- std::vector<sbCollection::item> data;
- float version;
-};
-
-#endif
Deleted: trunk/src/SlideBible/sbCross.h
===================================================================
--- trunk/src/SlideBible/sbCross.h 2010-03-08 21:37:47 UTC (rev 227)
+++ trunk/src/SlideBible/sbCross.h 2010-03-08 21:45:26 UTC (rev 228)
@@ -1,55 +0,0 @@
-/*************************************************************************
-* sbCross.h - platform dependent types and functions
-*
-* author: Konstantin Maslyuk "Kalemas" mailto:kalemas at mail.ru
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License as published by the
-* Free Software Foundation version 2.
-*
-* This program is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* General Public License for more details.
-************************************************************************/
-
-#ifndef SBCROSS_H
-#define SBCROSS_H
-
-#include <windows.h>
-
-typedef LONG sbLong;
-
-typedef COLORREF sbColor;
-
-class sbRect : public RECT
-{
-public:
- sbRect(sbLong _left=0, sbLong _top=0, sbLong _right=0, sbLong _bottom=0)
- {
- RECT::left = _left;
- RECT::top = _top;
- RECT::right = _right;
- RECT::bottom = _bottom;
-
- ASSERT(RECT::top <= RECT::bottom);
- ASSERT(RECT::left <= RECT::right);
- }
-
- inline sbLong top () const {return RECT::top;}
- inline void top (sbLong v) {RECT::top = v;}
- inline sbLong bottom () const {return RECT::bottom;}
- inline void bottom (sbLong v) {RECT::bottom = v;}
- inline sbLong left () const {return RECT::left;}
- inline void left (sbLong v) {RECT::left = v;}
- inline sbLong right () const {return RECT::right;}
- inline void right (sbLong v) {RECT::right = v;}
-
- inline sbLong width () const {return RECT::right - RECT::left;}
- inline sbLong height () const {return RECT::bottom - RECT::top;}
-
- inline bool pointInRect (sbLong x, sbLong y) const {return (x >= RECT::left && x < RECT::right && y >= RECT::top && y < RECT::bottom);}
-
-};
-
-#endif
Deleted: trunk/src/SlideBible/sbObject.h
===================================================================
--- trunk/src/SlideBible/sbObject.h 2010-03-08 21:37:47 UTC (rev 227)
+++ trunk/src/SlideBible/sbObject.h 2010-03-08 21:45:26 UTC (rev 228)
@@ -1,41 +0,0 @@
-/*************************************************************************
-* sbObject.cpp - memory tracker
-*
-* author: Konstantin Maslyuk "Kalemas" mailto:kalemas at mail.ru
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License as published by the
-* Free Software Foundation version 2.
-*
-* This program is distributed in the hope that it will be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* General Public License for more details.
-************************************************************************/
-
-#ifndef SBOBJECT_H
-#define SBOBJECT_H
-
-#include <map>
-
-class sbObject
-{
-public:
- sbObject ( const char * _name_ )
- {
- name = _name_;
- tracker[name] += 1;
- }
-
- ~sbObject ()
- {
- tracker[name] -= 1;
- }
-
- static std::map<const char *, int> tracker;
-
-private:
- const char * name;
-};
-
-#endif
More information about the sword-cvs
mailing list