|
From: <at...@us...> - 2007-11-24 05:20:50
|
Revision: 550
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=550&view=rev
Author: atani
Date: 2007-11-23 21:20:47 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
* version number support
* fix include paths for gui stuff
Modified Paths:
--------------
tiki/dc/Makefile
tiki/include/Tiki/tiki.h
tiki/nds/Makefile
tiki/osx/English.lproj/InfoPlist.strings
tiki/osx/Tiki.xcodeproj/project.pbxproj
tiki/sdl/Makefile
tiki/src/gui/button.cpp
tiki/src/gui/graphic.cpp
tiki/src/gui/radiobutton.cpp
tiki/src/gui/spinner.cpp
tiki/src/gui/text.cpp
tiki/src/gui/widget.cpp
tiki/src/gui/window.cpp
tiki/src/net/http/useragent.cpp
tiki/win32/tiki.vcproj
Added Paths:
-----------
tiki/osx/Info.plist.in
tiki/src/base/version.cpp.in
Removed Paths:
-------------
tiki/osx/Info.plist
tiki/src/gui/widget.h
Property Changed:
----------------
tiki/src/base/
Modified: tiki/dc/Makefile
===================================================================
--- tiki/dc/Makefile 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/dc/Makefile 2007-11-24 05:20:47 UTC (rev 550)
@@ -1,5 +1,6 @@
BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/oggvorbis/*.cpp))
BASE_BASE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/base/*.cpp))
+BASE_BASE_OBJ+= ../src/base/version.o
BASE_GL_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/*.cpp))
BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/anims/*.cpp))
BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/drawables/*.cpp))
@@ -21,7 +22,7 @@
$(KOS_AR) ru libtiki.a $(BASE_OBJS)
clean: clean_subdirs
- -rm -f $(BASE_OBJS) libtiki.a
+ -rm -f $(BASE_OBJS) libtiki.a ../src/base/version.cpp
$(MAKE) TIKI_PLAT=dc -C$(CURDIR)/../examples clean
examples:
@@ -42,4 +43,7 @@
zip -9r ../tiki-$(SVN_VERSION)-dc.zip Library Samples
rm -rf ../dist/$(SVN_VERSION)/tmp
+../src/base/version.cpp: ../src/base/version.cpp.in
+ sed "s/\$$WCREV\\$$/`svnversion .`/" < ../src/base/version.cpp.in > ../src/base/version.cpp
+
include Makefile.rules
Modified: tiki/include/Tiki/tiki.h
===================================================================
--- tiki/include/Tiki/tiki.h 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/include/Tiki/tiki.h 2007-11-24 05:20:47 UTC (rev 550)
@@ -44,6 +44,9 @@
// Bring STL string into the namespace.
using std::string;
+ const string getVersion();
+ const string getPlatformName();
+
// Global init/shutdown functions.
bool init( int argc, char **argv );
void shutdown();
Modified: tiki/nds/Makefile
===================================================================
--- tiki/nds/Makefile 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/nds/Makefile 2007-11-24 05:20:47 UTC (rev 550)
@@ -2,6 +2,7 @@
# BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/*.cpp))
BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/oggvorbis/*.cpp))
BASE_BASE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/base/*.cpp))
+BASE_BASE_OBJ+=../src/base/version.o
BASE_GL_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/*.cpp))
BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/anims/*.cpp))
BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/drawables/*.cpp))
@@ -56,7 +57,7 @@
$(AR) ru libtiki.a $(BASE_OBJS) $(THIRD_PARTY_OBJS)
clean: clean_subdirs
- -rm -f $(BASE_OBJS) $(THIRD_PARTY_OBJS) libtiki.a
+ -rm -f $(BASE_OBJS) $(THIRD_PARTY_OBJS) libtiki.a ../src/base/version.cpp
$(MAKE) -C tikiarm7 clean TOPDIR=$(CURDIR)
$(MAKE) TIKI_PLAT=nds -C$(CURDIR)/../examples clean
@@ -86,5 +87,8 @@
zip -9r ../tiki-$(SVN_VERSION)-nds.zip Library Samples
rm -rf ../dist/$(SVN_VERSION)/tmp
+../src/base/version.cpp: ../src/base/version.cpp.in
+ sed "s/\$$WCREV\\$$/`svnversion .`/" < ../src/base/version.cpp.in > ../src/base/version.cpp
+
DEPSDIR=$(CURDIR)
include Makefile.rules
Modified: tiki/osx/English.lproj/InfoPlist.strings
===================================================================
(Binary files differ)
Deleted: tiki/osx/Info.plist
===================================================================
--- tiki/osx/Info.plist 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/osx/Info.plist 2007-11-24 05:20:47 UTC (rev 550)
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>Tiki</string>
- <key>CFBundleIconFile</key>
- <string></string>
- <key>CFBundleIdentifier</key>
- <string>com.cagames.Tiki</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundlePackageType</key>
- <string>FMWK</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0</string>
- <key>NSPrincipalClass</key>
- <string></string>
-</dict>
-</plist>
Copied: tiki/osx/Info.plist.in (from rev 549, tiki/osx/Info.plist)
===================================================================
--- tiki/osx/Info.plist.in (rev 0)
+++ tiki/osx/Info.plist.in 2007-11-24 05:20:47 UTC (rev 550)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>Tiki</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.cagames.Tiki</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>0.0.$WCREV$</string>
+ <key>NSPrincipalClass</key>
+ <string></string>
+</dict>
+</plist>
Modified: tiki/osx/Tiki.xcodeproj/project.pbxproj
===================================================================
--- tiki/osx/Tiki.xcodeproj/project.pbxproj 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/osx/Tiki.xcodeproj/project.pbxproj 2007-11-24 05:20:47 UTC (rev 550)
@@ -8,40 +8,25 @@
/* Begin PBXBuildFile section */
223226810A165A600035025E /* console.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 223226800A165A600035025E /* console.cpp */; };
- 223226830A165A7A0035025E /* console.h in Headers */ = {isa = PBXBuildFile; fileRef = 223226820A165A7A0035025E /* console.h */; };
2290A0FD09302D7500B7D80C /* cursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2290A0FB09302D7500B7D80C /* cursor.cpp */; };
2290A0FE09302D7500B7D80C /* pointerArrow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2290A0FC09302D7500B7D80C /* pointerArrow.cpp */; };
- 2290A10109302D9F00B7D80C /* cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2290A0FF09302D9F00B7D80C /* cursor.h */; };
- 2290A10209302D9F00B7D80C /* pointerArrow.h in Headers */ = {isa = PBXBuildFile; fileRef = 2290A10009302D9F00B7D80C /* pointerArrow.h */; };
6400608E0CDF9DC800969916 /* init_flags_default.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6400608D0CDF9DC800969916 /* init_flags_default.cpp */; };
- 6406D0440CF3C737002D832F /* button.h in Headers */ = {isa = PBXBuildFile; fileRef = 6406D0430CF3C737002D832F /* button.h */; };
6406D04D0CF3CBEC002D832F /* widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6406D04B0CF3CBEC002D832F /* widget.cpp */; };
6406D0540CF3CDF6002D832F /* button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6406D0530CF3CDF6002D832F /* button.cpp */; };
- 640C2C30092EB8C40032DE40 /* alpharotate.h in Headers */ = {isa = PBXBuildFile; fileRef = 640C2C2F092EB8C40032DE40 /* alpharotate.h */; };
- 642E949A0CF54A780005C8A5 /* radiobutton.h in Headers */ = {isa = PBXBuildFile; fileRef = 642E94990CF54A780005C8A5 /* radiobutton.h */; };
- 642E949E0CF54B550005C8A5 /* window.h in Headers */ = {isa = PBXBuildFile; fileRef = 642E949D0CF54B550005C8A5 /* window.h */; };
642E94AE0CF54DB90005C8A5 /* radiobutton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 642E94AD0CF54DB90005C8A5 /* radiobutton.cpp */; };
642E94D00CF54EF10005C8A5 /* window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 642E94CF0CF54EF10005C8A5 /* window.cpp */; };
642E94E50CF54FF20005C8A5 /* text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 642E94E40CF54FF20005C8A5 /* text.cpp */; };
642E94E80CF5501D0005C8A5 /* graphic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 642E94E70CF5501D0005C8A5 /* graphic.cpp */; };
- 642E95860CF561D20005C8A5 /* spinner.h in Headers */ = {isa = PBXBuildFile; fileRef = 642E95850CF561D20005C8A5 /* spinner.h */; };
642E958B0CF5642F0005C8A5 /* spinner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 642E958A0CF5642F0005C8A5 /* spinner.cpp */; };
6444BEE60932A3D800A29768 /* texturetile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6444BEE50932A3D700A29768 /* texturetile.cpp */; };
- 6444BEE80932A3F200A29768 /* texturetile.h in Headers */ = {isa = PBXBuildFile; fileRef = 6444BEE70932A3F200A29768 /* texturetile.h */; };
644D23550CDFE82D00E7F291 /* lightbarmenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 644D23540CDFE82D00E7F291 /* lightbarmenu.cpp */; };
- 644D23570CDFE83C00E7F291 /* lightbarmenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 644D23560CDFE83C00E7F291 /* lightbarmenu.h */; };
- 64618A5B0CEBE9A000881556 /* widget.h in Headers */ = {isa = PBXBuildFile; fileRef = 64618A5A0CEBE9A000881556 /* widget.h */; };
6499FE6A0C862377008D9FEF /* tinyxml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6499FE660C862377008D9FEF /* tinyxml.cpp */; };
- 6499FE6B0C862377008D9FEF /* tinyxml.h in Headers */ = {isa = PBXBuildFile; fileRef = 6499FE670C862377008D9FEF /* tinyxml.h */; };
6499FE6C0C862377008D9FEF /* tinyxmlerror.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6499FE680C862377008D9FEF /* tinyxmlerror.cpp */; };
6499FE6D0C862377008D9FEF /* tinyxmlparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6499FE690C862377008D9FEF /* tinyxmlparser.cpp */; };
6499FE710C8623A3008D9FEF /* base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6499FE6F0C8623A3008D9FEF /* base64.cpp */; };
6499FE720C8623A3008D9FEF /* date.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6499FE700C8623A3008D9FEF /* date.cpp */; };
- 6499FE760C8623D6008D9FEF /* base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 6499FE740C8623D6008D9FEF /* base64.h */; };
- 6499FE770C8623D6008D9FEF /* date.h in Headers */ = {isa = PBXBuildFile; fileRef = 6499FE750C8623D6008D9FEF /* date.h */; };
- 6499FEA40C8640CA008D9FEF /* cookiejar.h in Headers */ = {isa = PBXBuildFile; fileRef = 6499FEA30C8640CA008D9FEF /* cookiejar.h */; };
6499FEA60C8640E5008D9FEF /* cookiejar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6499FEA50C8640E5008D9FEF /* cookiejar.cpp */; };
- 64D758F4092EB9A5002667EE /* sleep.h in Headers */ = {isa = PBXBuildFile; fileRef = 64D758F3092EB9A5002667EE /* sleep.h */; };
+ 649CF73E0CF7E00400CC8D65 /* version.cpp.in in Sources */ = {isa = PBXBuildFile; fileRef = 649CF73D0CF7E00400CC8D65 /* version.cpp.in */; };
64ED75F50C7CFAE500D16D5C /* address.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75F10C7CFAE500D16D5C /* address.cpp */; };
64ED75F60C7CFAE500D16D5C /* socket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75F20C7CFAE500D16D5C /* socket.cpp */; };
64ED75F70C7CFAE500D16D5C /* tcpserversocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75F30C7CFAE500D16D5C /* tcpserversocket.cpp */; };
@@ -49,22 +34,7 @@
64ED75FD0C7CFB1800D16D5C /* request.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75FA0C7CFB1800D16D5C /* request.cpp */; };
64ED75FE0C7CFB1800D16D5C /* response.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75FB0C7CFB1800D16D5C /* response.cpp */; };
64ED75FF0C7CFB1800D16D5C /* useragent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED75FC0C7CFB1800D16D5C /* useragent.cpp */; };
- 64ED76190C7CFB4C00D16D5C /* address.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76130C7CFB4C00D16D5C /* address.h */; };
- 64ED761A0C7CFB4C00D16D5C /* buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76140C7CFB4C00D16D5C /* buffer.h */; };
- 64ED761B0C7CFB4C00D16D5C /* socket.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76150C7CFB4C00D16D5C /* socket.h */; };
- 64ED761C0C7CFB4C00D16D5C /* tcpserversocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76160C7CFB4C00D16D5C /* tcpserversocket.h */; };
- 64ED761D0C7CFB4C00D16D5C /* tcpsocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76170C7CFB4C00D16D5C /* tcpsocket.h */; };
- 64ED761E0C7CFB4C00D16D5C /* udpsocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76180C7CFB4C00D16D5C /* udpsocket.h */; };
- 64ED76230C7CFB6200D16D5C /* cookie.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED761F0C7CFB6200D16D5C /* cookie.h */; };
- 64ED76240C7CFB6200D16D5C /* request.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76200C7CFB6200D16D5C /* request.h */; };
- 64ED76250C7CFB6200D16D5C /* response.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76210C7CFB6200D16D5C /* response.h */; };
- 64ED76260C7CFB6200D16D5C /* useragent.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76220C7CFB6200D16D5C /* useragent.h */; };
- 64ED76290C7CFB7E00D16D5C /* endian.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76270C7CFB7E00D16D5C /* endian.h */; };
- 64ED762A0C7CFB7E00D16D5C /* net.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED76280C7CFB7E00D16D5C /* net.h */; };
64ED762C0C7CFB9400D16D5C /* platnet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 64ED762B0C7CFB9400D16D5C /* platnet.cpp */; };
- 64ED762E0C7CFBA100D16D5C /* platnet.h in Headers */ = {isa = PBXBuildFile; fileRef = 64ED762D0C7CFBA100D16D5C /* platnet.h */; };
- 64F19E9A0CF5391F0093AEAD /* text.h in Headers */ = {isa = PBXBuildFile; fileRef = 64F19E990CF5391F0093AEAD /* text.h */; };
- 64F19ECB0CF53D740093AEAD /* graphic.h in Headers */ = {isa = PBXBuildFile; fileRef = 64F19ECA0CF53D740093AEAD /* graphic.h */; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
C4287F7C07C9491100D238E1 /* image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4287F7B07C9491100D238E1 /* image.cpp */; };
@@ -176,7 +146,6 @@
C4B1829D0856B2E600B46BDA /* vorbisfile.c in Sources */ = {isa = PBXBuildFile; fileRef = C4B182860856B2E600B46BDA /* vorbisfile.c */; };
C4B1829E0856B2E600B46BDA /* window.c in Sources */ = {isa = PBXBuildFile; fileRef = C4B182870856B2E600B46BDA /* window.c */; };
C4B5838D0794CFC7004D22F2 /* init_shutdown.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4B5838C0794CFC7004D22F2 /* init_shutdown.cpp */; };
- C4EAEB2008678F1F003F5342 /* TikiAll.h in Headers */ = {isa = PBXBuildFile; fileRef = C4EAEB1F08678F1F003F5342 /* TikiAll.h */; settings = {ATTRIBUTES = (Private, ); }; };
C4ED4B98079CE776006E3DF0 /* sndoggvorbis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4ED4B97079CE776006E3DF0 /* sndoggvorbis.cpp */; };
C4F5148E0799FBA10001D0D0 /* endian.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4F5148D0799FBA10001D0D0 /* endian.cpp */; };
C4F514AE079A02AE0001D0D0 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4F514AC079A02AE0001D0D0 /* AudioUnit.framework */; };
@@ -255,6 +224,7 @@
6499FE750C8623D6008D9FEF /* date.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = date.h; path = ../include/Tiki/net/util/date.h; sourceTree = SOURCE_ROOT; };
6499FEA30C8640CA008D9FEF /* cookiejar.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = cookiejar.h; path = ../include/Tiki/net/http/cookiejar.h; sourceTree = SOURCE_ROOT; };
6499FEA50C8640E5008D9FEF /* cookiejar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = cookiejar.cpp; path = ../src/net/http/cookiejar.cpp; sourceTree = SOURCE_ROOT; };
+ 649CF73D0CF7E00400CC8D65 /* version.cpp.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; path = version.cpp.in; sourceTree = "<group>"; };
64D758F3092EB9A5002667EE /* sleep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sleep.h; path = ../include/Tiki/anims/sleep.h; sourceTree = SOURCE_ROOT; };
64ED75F10C7CFAE500D16D5C /* address.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = address.cpp; path = ../src/net/address.cpp; sourceTree = SOURCE_ROOT; };
64ED75F20C7CFAE500D16D5C /* socket.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = socket.cpp; path = ../src/net/socket.cpp; sourceTree = SOURCE_ROOT; };
@@ -279,7 +249,6 @@
64ED762D0C7CFBA100D16D5C /* platnet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = platnet.h; path = include/Tiki/platnet.h; sourceTree = "<group>"; };
64F19E990CF5391F0093AEAD /* text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = text.h; path = ../include/Tiki/gui/text.h; sourceTree = SOURCE_ROOT; };
64F19ECA0CF53D740093AEAD /* graphic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = graphic.h; path = ../include/Tiki/gui/graphic.h; sourceTree = SOURCE_ROOT; };
- 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* Tiki.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Tiki.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C40D72C1083723B50084B52D /* design_v2.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = design_v2.rtf; path = ../notes/design_v2.rtf; sourceTree = SOURCE_ROOT; };
C40D72C2083723B50084B52D /* drawing_model.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = drawing_model.txt; path = ../notes/drawing_model.txt; sourceTree = SOURCE_ROOT; };
@@ -533,7 +502,6 @@
089C1665FE841158C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
- 8DC2EF5A0486A6940098B216 /* Info.plist */,
089C1666FE841158C02AAC07 /* InfoPlist.strings */,
);
name = Resources;
@@ -718,6 +686,7 @@
C480A22E0835BEA6006AEE4B /* object.cpp */,
C45D0B90083F030200F9F467 /* timeline.cpp */,
C45D0B91083F030200F9F467 /* timepoint.cpp */,
+ 649CF73D0CF7E00400CC8D65 /* version.cpp.in */,
);
name = base;
path = ../src/base;
@@ -1178,54 +1147,12 @@
};
/* End PBXGroup section */
-/* Begin PBXHeadersBuildPhase section */
- 8DC2EF500486A6940098B216 /* Headers */ = {
- isa = PBXHeadersBuildPhase;
- buildActionMask = 2147483647;
- files = (
- C4EAEB2008678F1F003F5342 /* TikiAll.h in Headers */,
- 640C2C30092EB8C40032DE40 /* alpharotate.h in Headers */,
- 64D758F4092EB9A5002667EE /* sleep.h in Headers */,
- 2290A10109302D9F00B7D80C /* cursor.h in Headers */,
- 2290A10209302D9F00B7D80C /* pointerArrow.h in Headers */,
- 6444BEE80932A3F200A29768 /* texturetile.h in Headers */,
- 223226830A165A7A0035025E /* console.h in Headers */,
- 64ED76190C7CFB4C00D16D5C /* address.h in Headers */,
- 64ED761A0C7CFB4C00D16D5C /* buffer.h in Headers */,
- 64ED761B0C7CFB4C00D16D5C /* socket.h in Headers */,
- 64ED761C0C7CFB4C00D16D5C /* tcpserversocket.h in Headers */,
- 64ED761D0C7CFB4C00D16D5C /* tcpsocket.h in Headers */,
- 64ED761E0C7CFB4C00D16D5C /* udpsocket.h in Headers */,
- 64ED76230C7CFB6200D16D5C /* cookie.h in Headers */,
- 64ED76240C7CFB6200D16D5C /* request.h in Headers */,
- 64ED76250C7CFB6200D16D5C /* response.h in Headers */,
- 64ED76260C7CFB6200D16D5C /* useragent.h in Headers */,
- 64ED76290C7CFB7E00D16D5C /* endian.h in Headers */,
- 64ED762A0C7CFB7E00D16D5C /* net.h in Headers */,
- 64ED762E0C7CFBA100D16D5C /* platnet.h in Headers */,
- 6499FE6B0C862377008D9FEF /* tinyxml.h in Headers */,
- 6499FE760C8623D6008D9FEF /* base64.h in Headers */,
- 6499FE770C8623D6008D9FEF /* date.h in Headers */,
- 6499FEA40C8640CA008D9FEF /* cookiejar.h in Headers */,
- 644D23570CDFE83C00E7F291 /* lightbarmenu.h in Headers */,
- 64618A5B0CEBE9A000881556 /* widget.h in Headers */,
- 6406D0440CF3C737002D832F /* button.h in Headers */,
- 64F19E9A0CF5391F0093AEAD /* text.h in Headers */,
- 64F19ECB0CF53D740093AEAD /* graphic.h in Headers */,
- 642E949A0CF54A780005C8A5 /* radiobutton.h in Headers */,
- 642E949E0CF54B550005C8A5 /* window.h in Headers */,
- 642E95860CF561D20005C8A5 /* spinner.h in Headers */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXHeadersBuildPhase section */
-
/* Begin PBXNativeTarget section */
8DC2EF4F0486A6940098B216 /* Tiki */ = {
isa = PBXNativeTarget;
buildConfigurationList = C4B181A70856AE7000B46BDA /* Build configuration list for PBXNativeTarget "Tiki" */;
buildPhases = (
- 8DC2EF500486A6940098B216 /* Headers */,
+ 649CF7110CF7DD0C00CC8D65 /* ShellScript */,
8DC2EF520486A6940098B216 /* Resources */,
8DC2EF540486A6940098B216 /* Sources */,
8DC2EF560486A6940098B216 /* Frameworks */,
@@ -1272,6 +1199,23 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
+ 649CF7110CF7DD0C00CC8D65 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(SRCROOT)/../src/base/version.cpp.in",
+ "$(SRCROOT)/Info.plist.in",
+ );
+ outputPaths = (
+ "$(SRCROOT)/../src/base/version.cpp",
+ "$(SRCROOT)/Info.plist",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "sed \"s/\\$WCREV\\\\$/`svnversion .`/\" < $SRCROOT/../src/base/version.cpp.in > $SRCROOT/../src/base/version.cpp\nsed \"s/\\$WCREV\\\\$/`svnversion .`/\" < $SRCROOT/Info.plist.in > $SRCROOT/Info.plist";
+ };
C4EC17C5084441E40005E60B /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -1446,6 +1390,7 @@
642E94E50CF54FF20005C8A5 /* text.cpp in Sources */,
642E94E80CF5501D0005C8A5 /* graphic.cpp in Sources */,
642E958B0CF5642F0005C8A5 /* spinner.cpp in Sources */,
+ 649CF73E0CF7E00400CC8D65 /* version.cpp.in in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: tiki/sdl/Makefile
===================================================================
--- tiki/sdl/Makefile 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/sdl/Makefile 2007-11-24 05:20:47 UTC (rev 550)
@@ -2,6 +2,7 @@
BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/*.cpp))
BASE_AUDIO_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/oggvorbis/*.cpp))
BASE_BASE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/base/*.cpp))
+BASE_BASE_OBJ+=../src/base/version.o
BASE_GL_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/*.cpp))
BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/anims/*.cpp))
BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/drawables/*.cpp))
@@ -56,7 +57,7 @@
$(AR) ru libtiki.a $(BASE_OBJS) $(THIRD_PARTY_OBJS)
clean: clean_subdirs
- -rm -f $(BASE_OBJS) $(THIRD_PARTY_OBJS) libtiki.a
+ -rm -f $(BASE_OBJS) $(THIRD_PARTY_OBJS) libtiki.a ../src/base/version.cpp
$(MAKE) TIKI_PLAT=sdl -C$(CURDIR)/../examples clean
examples:
@@ -90,4 +91,7 @@
gzip ../tiki-$(SVN_VERSION)-sdl.tar
rm -rf ../dist/$(SVN_VERSION)/tmp
+../src/base/version.cpp: ../src/base/version.cpp.in
+ sed "s/\$$WCREV\\$$/`svnversion .`/" < ../src/base/version.cpp.in > ../src/base/version.cpp
+
include Makefile.rules
Property changes on: tiki/src/base
___________________________________________________________________
Name: svn:ignore
- *.d
+ *.d
version.cpp
Added: tiki/src/base/version.cpp.in
===================================================================
--- tiki/src/base/version.cpp.in (rev 0)
+++ tiki/src/base/version.cpp.in 2007-11-24 05:20:47 UTC (rev 550)
@@ -0,0 +1,35 @@
+/*
+ Tiki
+
+ version.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "pch.h"
+
+namespace Tiki {
+ const std::string TikiFrameworkVersion = "0.0.$WCREV$";
+ const string getVersion() {
+ return TikiFrameworkVersion;
+ }
+
+ const std::string TikiFrameworkPlatform =
+#if TIKI_PLAT == TIKI_WIN32
+ "Windows";
+#elif TIKI_PLAT == TIKI_NDS
+ "Nintendo DS";
+#elif TIKI_PLAT == TIKI_SDL
+ "SDL";
+#elif TIKI_PLAT == TIKI_OSX
+ "Mac OS X";
+#elif TIKI_PLAT == TIKI_DC
+ "Sega Dreamcast";
+#else
+ "Unknown";
+#endif
+ const string getPlatformName() {
+ return TikiFrameworkPlatform;
+ }
+}
+
Modified: tiki/src/gui/button.cpp
===================================================================
--- tiki/src/gui/button.cpp 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/src/gui/button.cpp 2007-11-24 05:20:47 UTC (rev 550)
@@ -7,8 +7,8 @@
*/
#include "pch.h"
-#include "Tiki/widget.h"
-#include "Tiki/button.h"
+#include "Tiki/gui/widget.h"
+#include "Tiki/gui/button.h"
using namespace Tiki::GUI;
using namespace Tiki::GL;
@@ -20,4 +20,4 @@
void Button::render(Drawable::ObjType mode) {
-}
\ No newline at end of file
+}
Modified: tiki/src/gui/graphic.cpp
===================================================================
--- tiki/src/gui/graphic.cpp 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/src/gui/graphic.cpp 2007-11-24 05:20:47 UTC (rev 550)
@@ -7,7 +7,7 @@
*/
#include "pch.h"
-#include "Tiki/graphic.h"
+#include "Tiki/gui/graphic.h"
using namespace Tiki::GUI;
using namespace Tiki::GL;
@@ -19,4 +19,4 @@
void Graphic::render(Drawable::ObjType mode) {
-}
\ No newline at end of file
+}
Modified: tiki/src/gui/radiobutton.cpp
===================================================================
--- tiki/src/gui/radiobutton.cpp 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/src/gui/radiobutton.cpp 2007-11-24 05:20:47 UTC (rev 550)
@@ -7,7 +7,7 @@
*/
#include "pch.h"
-#include "Tiki/radiobutton.h"
+#include "Tiki/gui/radiobutton.h"
using namespace Tiki::GUI;
using namespace Tiki::GL;
@@ -28,4 +28,4 @@
void RadioButtonGroup::render(Drawable::ObjType mode) {
-}
\ No newline at end of file
+}
Modified: tiki/src/gui/spinner.cpp
===================================================================
--- tiki/src/gui/spinner.cpp 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/src/gui/spinner.cpp 2007-11-24 05:20:47 UTC (rev 550)
@@ -7,7 +7,7 @@
*/
#include "pch.h"
-#include "Tiki/spinner.h"
+#include "Tiki/gui/spinner.h"
using namespace Tiki::GUI;
using namespace Tiki::GL;
@@ -19,4 +19,4 @@
void Spinner::render(Drawable::ObjType mode) {
-}
\ No newline at end of file
+}
Modified: tiki/src/gui/text.cpp
===================================================================
--- tiki/src/gui/text.cpp 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/src/gui/text.cpp 2007-11-24 05:20:47 UTC (rev 550)
@@ -7,7 +7,7 @@
*/
#include "pch.h"
-#include "Tiki/text.h"
+#include "Tiki/gui/text.h"
using namespace Tiki::GUI;
using namespace Tiki::GL;
@@ -18,4 +18,4 @@
void Text::render(Drawable::ObjType mode) {
-}
\ No newline at end of file
+}
Modified: tiki/src/gui/widget.cpp
===================================================================
--- tiki/src/gui/widget.cpp 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/src/gui/widget.cpp 2007-11-24 05:20:47 UTC (rev 550)
@@ -7,7 +7,7 @@
*/
#include "pch.h"
-#include "Tiki/widget.h"
+#include "Tiki/gui/widget.h"
using namespace Tiki::GUI;
@@ -22,4 +22,4 @@
}
m_cachedPos = pos;
return m_cachedPos;
-}
\ No newline at end of file
+}
Deleted: tiki/src/gui/widget.h
===================================================================
--- tiki/src/gui/widget.h 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/src/gui/widget.h 2007-11-24 05:20:47 UTC (rev 550)
@@ -1,9 +0,0 @@
-/*
- * widget.h
- * Tiki
- *
- * Created by Atani on 11/20/07.
- * Copyright 2007 __MyCompanyName__. All rights reserved.
- *
- */
-
Modified: tiki/src/gui/window.cpp
===================================================================
--- tiki/src/gui/window.cpp 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/src/gui/window.cpp 2007-11-24 05:20:47 UTC (rev 550)
@@ -7,7 +7,7 @@
*/
#include "pch.h"
-#include "Tiki/window.h"
+#include "Tiki/gui/window.h"
using namespace Tiki::GUI;
@@ -19,4 +19,4 @@
void Window::run() {
-}
\ No newline at end of file
+}
Modified: tiki/src/net/http/useragent.cpp
===================================================================
--- tiki/src/net/http/useragent.cpp 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/src/net/http/useragent.cpp 2007-11-24 05:20:47 UTC (rev 550)
@@ -1,483 +1,473 @@
-/*
- Tiki
-
- useragent.cpp
-
- Copyright (C)2007 Atani Software
-*/
-
-#include "pch.h"
-#include "Tiki/tiki.h"
-#include "Tiki/net.h"
-#include "Tiki/net/http/useragent.h"
-
-#include <sstream>
-#include <math.h>
-
-namespace Tiki {
-
-namespace Net {
-
-namespace Http {
-
-using namespace Tiki::Net::TCP;
-
-using std::string;
-using std::list;
-using std::stringstream;
-using std::istringstream;
-using std::ios;
-
-TIKI_OBJECT_NAME( HttpUserAgent )
-TIKI_OBJECT_BEGIN( Object, HttpUserAgent )
-TIKI_OBJECT_OUTLET( "progressUpdate" )
-TIKI_OBJECT_END( HttpUserAgent )
-
-HttpUserAgent::HttpUserAgent() {
-#if TIKI_PLAT == TIKI_WIN32
- m_userAgentName = "Tiki/1.0 (Windows)";
-#elif TIKI_PLAT == TIKI_NDS
- m_userAgentName = "Tiki/1.0 (Nintendo DS)";
-#elif TIKI_PLAT == TIKI_SDL
- m_userAgentName = "Tiki/1.0 (SDL)";
-#elif TIKI_PLAT == TIKI_OSX
- m_userAgentName = "Tiki/1.0 (Mac OS X)";
-#else
- m_userAgentName = "Tiki/1.0 (Unknown)";
-#endif
- m_proxyHost = "";
- m_proxyPort = 8080;
- m_ignoreCookies = true;
- m_cookieJar = NULL;
-}
-
-Response *HttpUserAgent::get(Request *req) {
-
- Response *response = new Response();
- response->setUrl(req->getUrl());
- response->setResultCode(200);
-
- string hostname;
- int port;
- string resource;
-
- parseUrl(req->getUrl(), hostname, resource, port);
-
- TCPSocket *socket;
- if(m_proxyHost.empty()) {
- socket = new TCPSocket(new Address(hostname, port));
- }
- else {
- socket = new TCPSocket(new Address(m_proxyHost, m_proxyPort));
- }
-
- socket->setNonBlocking(false);
-
- socket->open();
- if(!socket->isOpen()) {
- Tiki::Debug::printf("connect failed\n");
- response->setResultCode(504);
- return response;
- }
-
- string requestText;
- buildRequest(hostname, resource, port, "GET", req, requestText);
-
- Tiki::Debug::printf("Sending request...\n");
- Tiki::Debug::printf(requestText.c_str());
- socket->send(requestText);
-
- readResponse(response, socket);
-
- socket->close();
-
- delete socket;
-
- return response;
-}
-
-Response *HttpUserAgent::post(Request *req) {
- Response *response = new Response();
- response->setUrl(req->getUrl());
- response->setResultCode(200);
-
- string hostname;
- int port;
- string resource;
-
- parseUrl(req->getUrl(), hostname, resource, port);
-
- TCPSocket *socket;
- if(m_proxyHost.empty()) {
- socket = new TCPSocket(new Address(hostname, port));
- }
- else {
- socket = new TCPSocket(new Address(m_proxyHost, m_proxyPort));
- }
-
- socket->setNonBlocking(false);
-
- socket->open();
- if(!socket->isOpen()) {
- Tiki::Debug::printf("connect failed\n");
- response->setResultCode(504);
- return response;
- }
-
- string requestText;
- buildRequest(hostname, resource, port, "POST", req, requestText);
-
- Tiki::Debug::printf("Sending request...\n");
- socket->send(requestText);
-
- size_t maxSize = requestText.length();
- size_t sentSize = maxSize;
- list<string> content = req->getContentPartNames();
- for(list<string>::iterator iter = content.begin();
- iter != content.end();
- ++iter) {
- Buffer *buf = req->getContentPart(*iter);
- if(buf->getUsedDataLen() > 0) {
- maxSize += buf->getUsedDataLen();
- }
- }
- if(content.size() > 1 || req->isForcedMultiPartUpload()) {
- string status = "";
- socket->recv(status);
-
- for(list<string>::iterator iter = content.begin();
- iter != content.end();
- ++iter) {
- Buffer *buf = req->getContentPart(*iter);
- if(buf->getUsedDataLen() > 0) {
- stringstream temp;
- temp << "--" << req->getBoundaryMarker() << "\r\n";
- temp << "Content-Disposition: form-data; name=\"";
- if(!buf->getFieldName().empty()) {
- temp << buf->getFieldName();
- }
- else {
- temp << "File";
- }
- temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n\r\n";
- string headerText = temp.str();
- //Tiki::Debug::printf("CONTENT_HEADER:\n%s", headerText.c_str());
- socket->send(headerText);
- socket->send(buf);
- sentSize += buf->getUsedDataLen();
- SocketProgress *progress = new SocketProgress(maxSize, 0, sentSize);
- emit( "progressUpdate", progress );
- delete progress;
- }
- }
- string footerText = "\r\n--";
- footerText.append(req->getBoundaryMarker());
- footerText.append("--\r\n");
- socket->send(footerText);
- }
- else if(content.size() == 1) {
- Buffer *buf = req->getContentPart(*content.begin());
- if(buf->getUsedDataLen() > 0) {
- socket->send(buf);
- SocketProgress *progress = new SocketProgress(maxSize, 0, buf->getUsedDataLen());
- emit( "progressUpdate", progress );
- delete progress;
- }
-
- }
-
- readResponse(response, socket);
-
- socket->close();
-
- delete socket;
-
- return response;
-}
-
-void HttpUserAgent::parseUrl(const string url, string &host, string &resource, int &port) {
- string temp_url = url;
-
- // set defaults
- host = "";
- port = 80;
- resource = "/index.html";
-
- if(temp_url.find("http://") == 0) {
- temp_url = temp_url.substr(string("http://").length());
- }
- else if(temp_url.find("https://") == 0) {
- temp_url = temp_url.substr(string("https://").length());
- }
- host = temp_url.substr(0, temp_url.find("/"));
- if(temp_url.find("/") != string::npos) {
- resource = temp_url.substr(temp_url.find("/"));
- }
- if(host.find(":") != string::npos) {
- string portstr = url.substr(host.find(":"));
- port = atoi(portstr.c_str());
- host = host.substr(0, host.find(":"));
- }
-}
-
-void HttpUserAgent::buildRequest(const string host, const string resource, const int port,
- const string mode, Request *request, string &requestText) {
-
- stringstream req;
- if(m_proxyHost.empty()) {
- req << mode << " " << resource << " HTTP/1.1\r\n";
- req << "Host: " << host << "\r\n";
- }
- else {
- // proxy connection
- req << mode << " " << request->getUrl();
- if(port != 80) {
- req << ":" << port;
- }
- req << " HTTP/1.1\r\n";
- req << "Host: " << host << "\r\n";
- }
- list<string> params = request->getHeaderParamNames();
- for(list<string>::const_iterator param = params.begin();
- param != params.end();
- ++param) {
- req << *param << ": " << request->getHeaderParam(*param) << "\r\n";
- }
-
- if(!m_userAgentName.empty()) {
- req << "User-Agent: " << m_userAgentName << "\r\n";
- }
-
- if(m_cookieJar != NULL) {
- list<Cookie *> cookies = m_cookieJar->getCookies(host, resource);
- for(list<Cookie *>::iterator iter = cookies.begin();
- iter != cookies.end();
- ++iter) {
- req << "Cookie: $Version=" << (*iter)->getVersion() << "; ";
- req << (*iter)->getName() << "=" << (*iter)->getValue() << "; ";
- req << "$Path=" << (*iter)->getPath() << "\r\n";
- }
- }
-
- list<string> content = request->getContentPartNames();
- if(!mode.compare("POST") && (content.size() > 1 || request->isForcedMultiPartUpload())) {
- uint64 totalSize = 8 + request->getBoundaryMarker().length(); // account for the ending boundary
- for(list<string>::iterator iter = content.begin();
- iter != content.end();
- ++iter) {
- Buffer *buf = request->getContentPart(*iter);
- if(buf->getUsedDataLen() > 0) {
- totalSize += request->getBoundaryMarker().length() + 4;
- totalSize += buf->getUsedDataLen();
- stringstream temp;
- temp << "Content-Disposition: form-data; name=\"";
- if(!buf->getFieldName().empty()) {
- temp << buf->getFieldName();
- }
- else {
- temp << "File";
- }
- temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n\r\n";
-
- // add section header size
- totalSize += temp.str().length();
- }
- }
-
- req << "Content-Length: " << totalSize << "\r\n";
- req << "Expect: 100-continue\r\n";
- req << "Content-Type: multipart/form-data; boundary=" << request->getBoundaryMarker() << "\r\n";
- }
- else if(!mode.compare("POST") && content.size() == 1) {
- Buffer *buf = request->getContentPart(*content.begin());
- req << "Content-Type: " << buf->getContentType() << "\r\n";
- req << "Content-Length: " << buf->getUsedDataLen() << "\r\n";
- }
- req << "\r\n";
-
- requestText = req.str();
-}
-
-void HttpUserAgent::readResponse(Response *response, TCPSocket *socket) {
- string host, resource;
- int port;
- parseUrl(response->getUrl(), host, resource, port);
-
- string status = "";
- socket->recv(status);
-
- for(string::size_type i = 0; i < status.length(); i++) {
- if(status.at(i) == ' ') {
- response->setResultCode(atoi(status.c_str()+i + 1));
- break;
- }
- }
-
- size_t responseSize = -1;
- size_t receivedSoFar = 0;
- while(1) {
- string line = "";
- socket->recv(line);
- receivedSoFar += line.size();
- if(line.size() == 0) {
- // done with headers
- break;
- }
- if(line.find(":") != string::npos) {
- string field = line.substr(0, line.find(":"));
- string value = line.substr(line.find(":") + 1);
- while(value.at(0) == ' ') {
- value = value.substr(1);
- }
-
- if(!field.compare("Set-Cookie")) {
- if(!isIgnoreCookies()) {
- m_cookieJar->addCookie(value, host, resource);
- }
- }
- else if(!field.compare("Content-Length")) {
- responseSize = atoi(value.c_str());
- response->setHeaderParam(field, value);
- }
- else {
- response->setHeaderParam(field, value);
- }
- }
- if(responseSize != -1) {
- SocketProgress *progress = new SocketProgress(responseSize, receivedSoFar, 0);
- emit( "progressUpdate", progress );
- delete progress;
- }
- }
-
- Buffer *fullBuf;
- if(responseSize == -1)
- {
- fullBuf = new Buffer(1);
- }
- else
- {
- fullBuf = new Buffer(responseSize);
- }
-
- if(!response->getHeaderParam("Transfer-Encoding").compare("chunked")) {
- Tiki::Debug::printf("Encoding is chunked\n");
- // evil chunked encoding
- size_t totalSize = 0;
-
- size_t sizeDecoded = 0;
- do
- {
- sizeDecoded = 0;
- string size = "";
- socket->recv(size);
- if(size.empty()) {
- sizeDecoded = 1;
- continue;
- }
-
- istringstream sizestream(string("0x") + size);
- sizestream.unsetf(ios::dec);
- sizestream.setf(ios::skipws);
- sizestream >> sizeDecoded;
- responseSize = receivedSoFar + sizeDecoded;
-
- if(sizeDecoded > 0) {
- Buffer *chunkBuf = new Buffer(sizeDecoded);
- socket->recv(chunkBuf);
- receivedSoFar += chunkBuf->getUsedDataLen();
- SocketProgress *progress = new SocketProgress(responseSize, receivedSoFar, 0);
- emit( "progressUpdate", progress );
- delete progress;
- if(chunkBuf->getUsedDataLen() < sizeDecoded)
- {
- size_t needed = sizeDecoded - chunkBuf->getUsedDataLen();
- Buffer *chunkBuf2;
- if(needed > 4096) {
- chunkBuf2 = new Buffer(4096);
- }
- else {
- chunkBuf2 = new Buffer(needed);
- }
- while(needed > 0) {
- if(needed < chunkBuf2->getDataLen()) {
- delete chunkBuf2;
- chunkBuf2 = new Buffer(needed);
- }
- socket->recv(chunkBuf2);
- chunkBuf->append(chunkBuf2);
- if(chunkBuf2->getUsedDataLen() > 0) {
- receivedSoFar += chunkBuf2->getUsedDataLen();
- SocketProgress *progress = new SocketProgress(responseSize, receivedSoFar, 0);
- emit( "progressUpdate", progress );
- delete progress;
- }
- needed -= chunkBuf2->getUsedDataLen();
- }
- delete chunkBuf2;
- }
- totalSize += chunkBuf->getUsedDataLen();
- fullBuf->append(chunkBuf);
- delete chunkBuf;
- }
- } while(sizeDecoded > 0);
- }
- else if(response->getHeaderParam("Content-Length").compare("")) {
- Tiki::Debug::printf("Encoding is inline\n");
- size_t sizeDecoded = atoi(response->getHeaderParam("Content-Length").c_str());
-
- Buffer *chunkBuf = new Buffer(sizeDecoded);
- socket->recv(chunkBuf);
- receivedSoFar += chunkBuf->getUsedDataLen();
- SocketProgress *progress = new SocketProgress(responseSize, receivedSoFar, 0);
- emit( "progressUpdate", progress );
- delete progress;
- if(chunkBuf->getUsedDataLen() < sizeDecoded)
- {
- sizeDecoded -= chunkBuf->getUsedDataLen();
- Buffer *chunkBuf2;
- if(sizeDecoded > 4096) {
- chunkBuf2 = new Buffer(4096);
- }
- else {
- chunkBuf2 = new Buffer(sizeDecoded);
- }
- while(sizeDecoded > 0) {
- if(sizeDecoded < chunkBuf2->getDataLen()) {
- delete chunkBuf2;
- chunkBuf2 = new Buffer(sizeDecoded);
- }
- socket->recv(chunkBuf2);
- chunkBuf->append(chunkBuf2);
- if(chunkBuf2->getUsedDataLen() > 0) {
- receivedSoFar += chunkBuf2->getUsedDataLen();
- SocketProgress *progress = new SocketProgress(responseSize, receivedSoFar, 0);
- emit( "progressUpdate", progress );
- delete progress;
- }
- sizeDecoded -= chunkBuf2->getUsedDataLen();
- }
- delete chunkBuf2;
- }
- fullBuf->append(chunkBuf);
-
- delete chunkBuf;
- }
- else {
- Tiki::Debug::printf("Encoding is unknown\n");
- Tiki::Debug::printf("Dumping headers\nHEADER NAME -> VALUE");
- for(list<string>::iterator iter = response->getHeaderParamNames().begin();
- iter != response->getHeaderParamNames().end();
- ++iter) {
- Tiki::Debug::printf("%s -> %s\n", (*iter).c_str(), response->getHeaderParam(*iter).c_str());
- }
- }
- response->addContentPart(fullBuf, DEFAULT_CONTENT_PART);
-}
-
-}; // namespace Http
-
-}; // namespace Net
-
-}; // namespace Tiki
-
+/*
+ Tiki
+
+ useragent.cpp
+
+ Copyright (C)2007 Atani Software
+*/
+
+#include "pch.h"
+#include "Tiki/tiki.h"
+#include "Tiki/net.h"
+#include "Tiki/net/http/useragent.h"
+
+#include <sstream>
+#include <math.h>
+
+namespace Tiki {
+
+namespace Net {
+
+namespace Http {
+
+using namespace Tiki::Net::TCP;
+
+using std::string;
+using std::list;
+using std::stringstream;
+using std::istringstream;
+using std::ios;
+
+TIKI_OBJECT_NAME( HttpUserAgent )
+TIKI_OBJECT_BEGIN( Object, HttpUserAgent )
+TIKI_OBJECT_OUTLET( "progressUpdate" )
+TIKI_OBJECT_END( HttpUserAgent )
+
+HttpUserAgent::HttpUserAgent() {
+ m_userAgentName = string("Tiki/") + Tiki::getVersion() + string(" (") + Tiki::getPlatformName() + string(")");
+ m_proxyHost = "";
+ m_proxyPort = 8080;
+ m_ignoreCookies = true;
+ m_cookieJar = NULL;
+}
+
+Response *HttpUserAgent::get(Request *req) {
+
+ Response *response = new Response();
+ response->setUrl(req->getUrl());
+ response->setResultCode(200);
+
+ string hostname;
+ int port;
+ string resource;
+
+ parseUrl(req->getUrl(), hostname, resource, port);
+
+ TCPSocket *socket;
+ if(m_proxyHost.empty()) {
+ socket = new TCPSocket(new Address(hostname, port));
+ }
+ else {
+ socket = new TCPSocket(new Address(m_proxyHost, m_proxyPort));
+ }
+
+ socket->setNonBlocking(false);
+
+ socket->open();
+ if(!socket->isOpen()) {
+ Tiki::Debug::printf("connect failed\n");
+ response->setResultCode(504);
+ return response;
+ }
+
+ string requestText;
+ buildRequest(hostname, resource, port, "GET", req, requestText);
+
+ Tiki::Debug::printf("Sending request...\n");
+ Tiki::Debug::printf(requestText.c_str());
+ socket->send(requestText);
+
+ readResponse(response, socket);
+
+ socket->close();
+
+ delete socket;
+
+ return response;
+}
+
+Response *HttpUserAgent::post(Request *req) {
+ Response *response = new Response();
+ response->setUrl(req->getUrl());
+ response->setResultCode(200);
+
+ string hostname;
+ int port;
+ string resource;
+
+ parseUrl(req->getUrl(), hostname, resource, port);
+
+ TCPSocket *socket;
+ if(m_proxyHost.empty()) {
+ socket = new TCPSocket(new Address(hostname, port));
+ }
+ else {
+ socket = new TCPSocket(new Address(m_proxyHost, m_proxyPort));
+ }
+
+ socket->setNonBlocking(false);
+
+ socket->open();
+ if(!socket->isOpen()) {
+ Tiki::Debug::printf("connect failed\n");
+ response->setResultCode(504);
+ return response;
+ }
+
+ string requestText;
+ buildRequest(hostname, resource, port, "POST", req, requestText);
+
+ Tiki::Debug::printf("Sending request...\n");
+ socket->send(requestText);
+
+ size_t maxSize = requestText.length();
+ size_t sentSize = maxSize;
+ list<string> content = req->getContentPartNames();
+ for(list<string>::iterator iter = content.begin();
+ iter != content.end();
+ ++iter) {
+ Buffer *buf = req->getContentPart(*iter);
+ if(buf->getUsedDataLen() > 0) {
+ maxSize += buf->getUsedDataLen();
+ }
+ }
+ if(content.size() > 1 || req->isForcedMultiPartUpload()) {
+ string status = "";
+ socket->recv(status);
+
+ for(list<string>::iterator iter = content.begin();
+ iter != content.end();
+ ++iter) {
+ Buffer *buf = req->getContentPart(*iter);
+ if(buf->getUsedDataLen() > 0) {
+ stringstream temp;
+ temp << "--" << req->getBoundaryMarker() << "\r\n";
+ temp << "Content-Disposition: form-data; name=\"";
+ if(!buf->getFieldName().empty()) {
+ temp << buf->getFieldName();
+ }
+ else {
+ temp << "File";
+ }
+ temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n\r\n";
+ string headerText = temp.str();
+ //Tiki::Debug::printf("CONTENT_HEADER:\n%s", headerText.c_str());
+ socket->send(headerText);
+ socket->send(buf);
+ sentSize += buf->getUsedDataLen();
+ SocketProgress *progress = new SocketProgress(maxSize, 0, sentSize);
+ emit( "progressUpdate", progress );
+ delete progress;
+ }
+ }
+ string footerText = "\r\n--";
+ footerText.append(req->getBoundaryMarker());
+ footerText.append("--\r\n");
+ socket->send(footerText);
+ }
+ else if(content.size() == 1) {
+ Buffer *buf = req->getContentPart(*content.begin());
+ if(buf->getUsedDataLen() > 0) {
+ socket->send(buf);
+ SocketProgress *progress = new SocketProgress(maxSize, 0, buf->getUsedDataLen());
+ emit( "progressUpdate", progress );
+ delete progress;
+ }
+
+ }
+
+ readResponse(response, socket);
+
+ socket->close();
+
+ delete socket;
+
+ return response;
+}
+
+void HttpUserAgent::parseUrl(const string url, string &host, string &resource, int &port) {
+ string temp_url = url;
+
+ // set defaults
+ host = "";
+ port = 80;
+ resource = "/index.html";
+
+ if(temp_url.find("http://") == 0) {
+ temp_url = temp_url.substr(string("http://").length());
+ }
+ else if(temp_url.find("https://") == 0) {
+ temp_url = temp_url.substr(string("https://").length());
+ }
+ host = temp_url.substr(0, temp_url.find("/"));
+ if(temp_url.find("/") != string::npos) {
+ resource = temp_url.substr(temp_url.find("/"));
+ }
+ if(host.find(":") != string::npos) {
+ string portstr = url.substr(host.find(":"));
+ port = atoi(portstr.c_str());
+ host = host.substr(0, host.find(":"));
+ }
+}
+
+void HttpUserAgent::buildRequest(const string host, const string resource, const int port,
+ const string mode, Request *request, string &requestText) {
+
+ stringstream req;
+ if(m_proxyHost.empty()) {
+ req << mode << " " << resource << " HTTP/1.1\r\n";
+ req << "Host: " << host << "\r\n";
+ }
+ else {
+ // proxy connection
+ req << mode << " " << request->getUrl();
+ if(port != 80) {
+ req << ":" << port;
+ }
+ req << " HTTP/1.1\r\n";
+ req << "Host: " << host << "\r\n";
+ }
+ list<string> params = request->getHeaderParamNames();
+ for(list<string>::const_iterator param = params.begin();
+ param != params.end();
+ ++param) {
+ req << *param << ": " << request->getHeaderParam(*param) << "\r\n";
+ }
+
+ if(!m_userAgentName.empty()) {
+ req << "User-Agent: " << m_userAgentName << "\r\n";
+ }
+
+ if(m_cookieJar != NULL) {
+ list<Cookie *> cookies = m_cookieJar->getCookies(host, resource);
+ for(list<Cookie *>::iterator iter = cookies.begin();
+ iter != cookies.end();
+ ++iter) {
+ req << "Cookie: $Version=" << (*iter)->getVersion() << "; ";
+ req << (*iter)->getName() << "=" << (*iter)->getValue() << "; ";
+ req << "$Path=" << (*iter)->getPath() << "\r\n";
+ }
+ }
+
+ list<string> content = request->getContentPartNames();
+ if(!mode.compare("POST") && (content.size() > 1 || request->isForcedMultiPartUpload())) {
+ uint64 totalSize = 8 + request->getBoundaryMarker().length(); // account for the ending boundary
+ for(list<string>::iterator iter = content.begin();
+ iter != content.end();
+ ++iter) {
+ Buffer *buf = request->getContentPart(*iter);
+ if(buf->getUsedDataLen() > 0) {
+ totalSize += request->getBoundaryMarker().length() + 4;
+ totalSize += buf->getUsedDataLen();
+ stringstream temp;
+ temp << "Content-Disposition: form-data; name=\"";
+ if(!buf->getFieldName().empty()) {
+ temp << buf->getFieldName();
+ }
+ else {
+ temp << "File";
+ }
+ temp << "\"; filename=\"" << buf->getFileNameShort() << "\"\r\nContent-Type: " << buf->getContentType() << "\r\n\r\n";
+
+ // add section header size
+ totalSize += temp.str().length();
+ }
+ }
+
+ req << "Content-Length: " << totalSize << "\r\n";
+ req << "Expect: 100-continue\r\n";
+ req << "Content-Type: multipart/form-data; boundary=" << request->getBoundaryMarker() << "\r\n";
+ }
+ else if(!mode.compare("POST") && content.size() == 1) {
+ Buffer *buf = request->getContentPart(*content.begin());
+ req << "Content-Type: " << buf->getContentType() << "\r\n";
+ req << "Content-Length: " << buf->getUsedDataLen() << "\r\n";
+ }
+ req << "\r\n";
+
+ requestText = req.str();
+}
+
+void HttpUserAgent::readResponse(Response *response, TCPSocket *socket) {
+ string host, resource;
+ int port;
+ parseUrl(response->getUrl(), host, resource, port);
+
+ string status = "";
+ socket->recv(status);
+
+ for(string::size_type i = 0; i < status.length(); i++) {
+ if(status.at(i) == ' ') {
+ response->setResultCode(atoi(status.c_str()+i + 1));
+ break;
+ }
+ }
+
+ size_t responseSize = -1;
+ size_t receivedSoFar = 0;
+ while(1) {
+ string line = "";
+ socket->recv(line);
+ receivedSoFar += line.size();
+ if(line.size() == 0) {
+ // done with headers
+ break;
+ }
+ if(line.find(":") != string::npos) {
+ string field = line.substr(0, line.find(":"));
+ string value = line.substr(line.find(":") + 1);
+ while(value.at(0) == ' ') {
+ value = value.substr(1);
+ }
+
+ if(!field.compare("Set-Cookie")) {
+ if(!isIgnoreCookies()) {
+ m_cookieJar->addCookie(value, host, resource);
+ }
+ }
+ else if(!field.compare("Content-Length")) {
+ responseSize = atoi(value.c_str());
+ response->setHeaderParam(field, value);
+ }
+ else {
+ response->setHeaderParam(field, value);
+ }
+ }
+ if(responseSize != -1) {
+ SocketProgress *progress = new SocketProgress(responseSize, receivedSoFar, 0);
+ emit( "progressUpdate", progress );
+ delete progress;
+ }
+ }
+
+ Buffer *fullBuf;
+ if(responseSize == -1)
+ {
+ fullBuf = new Buffer(1);
+ }
+ else
+ {
+ fullBuf = new Buffer(responseSize);
+ }
+
+ if(!response->getHeaderParam("Transfer-Encoding").compare("chunked")) {
+ Tiki::Debug::printf("Encoding is chunked\n");
+ // evil chunked encoding
+ size_t totalSize = 0;
+
+ size_t sizeDecoded = 0;
+ do
+ {
+ sizeDecoded = 0;
+ string size = "";
+ socket->recv(size);
+ if(size.empty()) {
+ sizeDecoded = 1;
+ continue;
+ }
+
+ istringstream sizestream(string("0x") + size);
+ sizestream.unsetf(ios::dec);
+ sizestream.setf(ios::skipws);
+ sizestream >> sizeDecoded;
+ responseSize = receivedSoFar + sizeDecoded;
+
+ if(sizeDecoded > 0) {
+ Buffer *chunkBuf = new Buffer(sizeDecoded);
+ socket->recv(chunkBuf);
+ receivedSoFar += chunkBuf->getUsedDataLen();
+ SocketProgress *progress = new SocketProgress(responseSize, receivedSoFar, 0);
+ emit( "progressUpdate", progress );
+ delete progress;
+ if(chunkBuf->getUsedDataLen() < sizeDecoded)
+ {
+ size_t needed = sizeDecoded - chunkBuf->getUsedDataLen();
+ Buffer *chunkBuf2;
+ if(needed > 4096) {
+ chunkBuf2 = new Buffer(4096);
+ }
+ else {
+ chunkBuf2 = new Buffer(needed);
+ }
+ while(needed > 0) {
+ if(needed < chunkBuf2->getDataLen()) {
+ delete chunkBuf2;
+ chunkBuf2 = new Buffer(needed);
+ }
+ socket->recv(chunkBuf2);
+ chunkBuf->append(chunkBuf2);
+ if(chunkBuf2->getUsedDataLen() > 0) {
+ receivedSoFar += chunkBuf2->getUsedDataLen();
+ SocketProgress *progress = new SocketProgress(responseSize, receivedSoFar, 0);
+ emit( "progressUpdate", progress );
+ delete progress;
+ }
+ needed -= chunkBuf2->getUsedDataLen();
+ }
+ delete chunkBuf2;
+ }
+ totalSize += chunkBuf->getUsedDataLen();
+ fullBuf->append(chunkBuf);
+ delete chunkBuf;
+ }
+ } while(sizeDecoded > 0);
+ }
+ else if(response->getHeaderParam("Content-Length").compare("")) {
+ Tiki::Debug::printf("Encoding is inline\n");
+ size_t sizeDecoded = atoi(response->getHeaderParam("Content-Length").c_str());
+
+ Buffer *chunkBuf = new Buffer(sizeDecoded);
+ socket->recv(chunkBuf);
+ receivedSoFar += chunkBuf->getUsedDataLen();
+ SocketProgress *progress = new SocketProgress(responseSize, receivedSoFar, 0);
+ emit( "progressUpdate", progress );
+ delete progress;
+ if(chunkBuf->getUsedDataLen() < sizeDecoded)
+ {
+ sizeDecoded -= chunkBuf->getUsedDataLen();
+ Buffer *chunkBuf2;
+ if(sizeDecoded > 4096) {
+ chunkBuf2 = new Buffer(4096);
+ }
+ else {
+ chunkBuf2 = new Buffer(sizeDecoded);
+ }
+ while(sizeDecoded > 0) {
+ if(sizeDecoded < chunkBuf2->getDataLen()) {
+ delete chunkBuf2;
+ chunkBuf2 = new Buffer(sizeDecoded);
+ }
+ socket->recv(chunkBuf2);
+ chunkBuf->append(chunkBuf2);
+ if(chunkBuf2->getUsedDataLen() > 0) {
+ receivedSoFar += chunkBuf2->getUsedDataLen();
+ SocketProgress *progress = new SocketProgress(responseSize, receivedSoFar, 0);
+ emit( "progressUpdate", progress );
+ delete progress;
+ }
+ sizeDecoded -= chunkBuf2->getUsedDataLen();
+ }
+ delete chunkBuf2;
+ }
+ fullBuf->append(chunkBuf);
+
+ delete chunkBuf;
+ }
+ else {
+ Tiki::Debug::printf("Encoding is unknown\n");
+ Tiki::Debug::printf("Dumping headers\nHEADER NAME -> VALUE");
+ for(list<string>::iterator iter = response->getHeaderParamNames().begin();
+ iter != response->getHeaderParamNames().end();
+ ++iter) {
+ Tiki::Debug::printf("%s -> %s\n", (*iter).c_str(), response->getHeaderParam(*iter).c_str());
+ }
+ }
+ response->addContentPart(fullBuf, DEFAULT_CONTENT_PART);
+}
+
+}; // namespace Http
+
+}; // namespace Net
+
+}; // namespace Tiki
+
Modified: tiki/win32/tiki.vcproj
===================================================================
--- tiki/win32/tiki.vcproj 2007-11-22 15:52:45 UTC (rev 549)
+++ tiki/win32/tiki.vcproj 2007-11-24 05:20:47 UTC (rev 550)
@@ -243,6 +243,37 @@
RelativePath="..\src\base\timepoint.cpp"
>
</File>
+ <File
+ RelativePath="..\src\base\version.cpp.in"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine=""c:\Program Files\TortoiseSVN\bin\SubWCRev.exe" . ..\src\base\version.cpp.in ..\src\base\version.cpp
"
+ Outputs="..\src\base\version.cpp"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine=""c:\Program Files\TortoiseSVN\bin\SubWCRev.exe" . ..\src\base\version.cpp.in ..\src\base\version.cpp
"
+ Outputs="..\src\base\version.cpp"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+
+ </File>
</Filter>
<Filter
Name="gl"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|