Galena :: xfirelib

This is a static archive of the original page - xfirelib is no longer maintained.
Navigation
Home
Board
Bug Tracker
Downloads

XFireGateway





User

You are currently not logged in.
Login
Register


0 logged in users.
18 active guests.


Project: xfirelib

Home
Board

variablevalue.h

Go to the documentation of this file.
00001 /*
00002  *  xfirelib - C++ Library for the xfire protocol.
00003  *  Copyright (C) 2006 by
00004  *          Beat Wolf <asraniel@fryx.ch> / http://gfire.sf.net
00005  *          Herbert Poul <herbert.poul@gmail.com> / http://goim.us
00006  *    http://xfirelib.sphene.net
00007  *
00008  *  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; either version 2 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU General Public License
00019  *  along with this program; if not, write to the Free Software
00020  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00021  */
00022 
00023 #include <string>
00024 
00025 #ifndef __VARIABVLEVALUE_H
00026 #define __VARIABVLEVALUE_H
00027 
00028 namespace xfirelib {
00029 
00030 class VariableValue {
00031  public:
00032     VariableValue();
00033     void setName(std::string name);
00034     void setValueLength(int valueLength);
00035     void setValue( char * value );
00036     void setValue( std::string value );
00037     void setValue( const char *value, int valueLength );
00038     void setValueFromLong( long value, int bytes );
00039     std::string getName();
00040     int getValueLength();
00041     char* getValue();
00042 
00043     int readName(char *packet, int index);
00044     int readValue(char *packet, int index, int length = -1, int ignoreZeroAfterLength = 0);
00045     int readVariableValue(char *packet, int index, int packetLength);
00046     /*TODO: disabled because of a bug in this method*/
00047     //int VariableValue::readFixValue(char *packet, int index, int packetLength, int valueLength);
00048 
00049     int writeName(char *buf, int index);
00050     int writeValue(char *buf, int index);
00051 
00052     long getValueAsLong();
00053   private:
00054     long myPow(int x, int y);
00055 
00056     std::string name;
00057     char *value;
00058     int valueLength;
00059 };
00060 
00061 };
00062 
00063 #endif

Powered by Galena
This page is powered by Galena. - Get your own free "CMS" (Wiki, Board, Todolist/Buglist-Tracker)
Author of Galena: Herbert Poul - kahless+galena@sphene.net - jabber id: kahless@sphene.net - icq uin: 50647169
Page generated in 16 millisecs