Raised This Month: $ Target: $400
 0% 

SourceMod Std


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 09-17-2005 , 16:01   SourceMod Std
Reply With Quote #1

Hey Bail

I was wondering how hard would it be to convert my plugins string referances to your std library ?

The only problem I could see was the way it returns w_char for c_str...Is it possible to convert that to char ?

Also, what are the namespaces needed ?

Thanks again,
c0ld
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
BAILOPAN
Join Date: Jan 2004
Old 09-17-2005 , 16:16  
Reply With Quote #2

SourceHook:: is the namespace. None of the string stuff returns wchar:

Code:
const char *c_str() { return v?v:""; }
It's not "std," by the way, it's "STL" (Standard Template Library). I guess we should call SourceHook the SourceHook Library (SHL and SHTL).

Conversion is not too hard, especially if you've done things like this:
Code:
typedef std::list<int> IntList;
Because then you can just change it to:
Code:
typedef SourceHook::List<int> IntList;
The advantage is you don't have to link to libstdc++.so. However, please note, only List is truly compatible with STL. CVector and String make some deviations that, if you use some of their detailed features, you might have to work around. And TinyHash is not a replacement for map, although it can be (as it's a dictionary template).
__________________
egg
BAILOPAN is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 09-17-2005 , 17:37  
Reply With Quote #3

Ok, it was just going on what was happening that time after you updated the CVS to 1.1, all my std::strings changed to yours which was very strange.

string is not a member of my SourceHook namespace o.O

I dont do anything other than append, substr, compare and find with it so it shouldnt be a problem.

String manipulation comes ez to me in any language once I get the basics right so a workaround wouldnt be a problem on my side, but C++ is still new to me, your talking to a guy who came from VB->PHP->Java and now C++, none of the others go as deep as C++ so sorry if i seem a lil slow sometimes.
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
sslice
Senior Member
Join Date: Feb 2005
Location: Texas, USA
Old 09-17-2005 , 18:31  
Reply With Quote #4

I believe it's String (not string) in the SourceHook namespace.
sslice is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 09-17-2005 , 20:55  
Reply With Quote #5

Sorry my mistake.

Im using VS 8 so it gives me a list of everything contained in the namespace and String is not there.
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
BAILOPAN
Join Date: Jan 2004
Old 09-17-2005 , 21:10  
Reply With Quote #6

VS8 is beta, VS7 shows everything fine for me. You might want to try Visual Assist X.
__________________
egg
BAILOPAN is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 09-17-2005 , 21:12  
Reply With Quote #7

Im a dufus, I just included <sourcehook\sh_string.h> and it worked fine.

Sorry for the trouble
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode