Entrar
Últimos assuntos
» player não consegue andarpor lovn7 Qui 21 Nov 2024, 13:33
» É possível fazer istó no game maker
por William Lima Qui 21 Nov 2024, 10:56
» Rio Rise - novo launcher do Gta San Andreas SAMP Brasil
por Lua Sáb 16 Nov 2024, 20:22
» (Resolvido) Cenario longo x Texture Pages
por josuedemoraes Sáb 16 Nov 2024, 15:31
» Kids' band
por Adilson Lucindo Santos Sex 15 Nov 2024, 12:23
» (RESOLVIDO) Engasgos-Troca de Sprites/animações
por josuedemoraes Ter 12 Nov 2024, 01:49
» Block Room - DEMO
por Joton Qua 06 Nov 2024, 22:58
» Game Infinito vertical (subindo)
por macmilam Sáb 26 Out 2024, 12:36
» Retorno da GMBR!!!
por Dancity Ter 22 Out 2024, 16:36
» Máquina de estados
por aminaro Qui 10 Out 2024, 13:33
» como faço pra um objeto colidir com o outro e diminuir a vida do player ?
por josuedemoraes Qui 03 Out 2024, 16:51
» RESOLVIDO: Colisão com objetos moveis
por josuedemoraes Qua 02 Out 2024, 20:28
» Crypt of the Blood Moon
por divin sphere Qua 11 Set 2024, 18:18
» como fazer um objeto seguir?
por divin sphere Dom 18 Ago 2024, 18:08
» Procuro de alguém para Modelar/Texturizar/Animar objetos 3D
por un00brn Dom 11 Ago 2024, 11:10
» Destruição de cenário (estilo DD Tank)
por CoronelZeg Sex 09 Ago 2024, 17:16
» RESOLVIDO-Como destruir uma instancia especifica de um objeto
por josuedemoraes Ter 23 Jul 2024, 00:40
» Automatizar a coleta de id
por GabrielXavier Seg 22 Jul 2024, 18:01
» Preciso de ajuda para concluir um pequeno projeto
por lmoura Qui 27 Jun 2024, 15:45
» ANGULO ACOMPANHAR O OBJETO
por Klinton Rodrigues Qui 27 Jun 2024, 08:34
» Musica reinicia quando sala reinicia
por GabrielXavier Ter 18 Jun 2024, 07:28
» como fazer uma copia de gd
por generico_cube Sex 14 Jun 2024, 15:48
» Square Adventure
por guilherme551 Ter 11 Jun 2024, 09:54
» como posso definir limite de uma variavel
por GabrielXavier Sex 07 Jun 2024, 14:14
» [Resolvido] Dúvida, colisão única de objeto
por vdm842 Sex 24 maio 2024, 09:50
Database Extension ( feito em c++ )
2 participantes
Página 1 de 1
Database Extension ( feito em c++ )
extençao para criar banco de dados no estilo SQL , podendo utilizar varios tipos de dados e salvar / carregar de um arquivo no disco
DOWNLOAD
OBS : Exemplo incluído
Funçoes :
{
database_create_int
database_create_double
database_create_string
database_create_byte
database_create_bool
database_create_short
database_create_float
database_add_int
database_add_double
database_add_string
database_add_byte
database_add_bool
database_add_short
database_add_float
database_find_int
database_find_double
database_find_string
database_find_byte
database_find_bool
database_find_short
database_find_float
database_remove_int
database_remove_double
database_remove_string
database_remove_byte
database_remove_bool
database_remove_short
database_remove_float
database_replace_int
database_replace_double
database_replace_string
database_replace_byte
database_replace_bool
database_replace_short
database_replace_float
database_get_int
database_get_double
database_get_string
database_get_byte
database_get_bool
database_get_short
database_get_float
database_size_int
database_size_double
database_size_string
database_size_byte
database_size_bool
database_size_short
database_size_float
}
DOWNLOAD
OBS : Exemplo incluído
Funçoes :
{
database_create_int
database_create_double
database_create_string
database_create_byte
database_create_bool
database_create_short
database_create_float
database_add_int
database_add_double
database_add_string
database_add_byte
database_add_bool
database_add_short
database_add_float
database_find_int
database_find_double
database_find_string
database_find_byte
database_find_bool
database_find_short
database_find_float
database_remove_int
database_remove_double
database_remove_string
database_remove_byte
database_remove_bool
database_remove_short
database_remove_float
database_replace_int
database_replace_double
database_replace_string
database_replace_byte
database_replace_bool
database_replace_short
database_replace_float
database_get_int
database_get_double
database_get_string
database_get_byte
database_get_bool
database_get_short
database_get_float
database_size_int
database_size_double
database_size_string
database_size_byte
database_size_bool
database_size_short
database_size_float
}
dungeon333- Data de inscrição : 29/05/2009
Reputação : 0
Número de Mensagens : 351
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Re: Database Extension ( feito em c++ )
PRA QUE ISSO SERVE? Mesmo assim, Baixando ja dou um edit
tata139- Data de inscrição : 11/08/2008
Reputação : 3
Número de Mensagens : 1121
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Re: Database Extension ( feito em c++ )
serve para criar banco de dados para salvar informaçoes;igual arquivos INI só que e bem + rapidotata139 escreveu:PRA QUE ISSO SERVE? Mesmo assim, Baixando ja dou um edit
eu testei aqui salvando 30 mil itens ele so demorou 38 milisegundos
como ver qto tempo demora
- Código:
time = database_write(filename);
show_message(string(time))
// time em milisegundos;
dungeon333- Data de inscrição : 29/05/2009
Reputação : 0
Número de Mensagens : 351
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Re: Database Extension ( feito em c++ )
=O Mto bom, agora vai ser mais facil de fazer traduções! e sem travar!
tata139- Data de inscrição : 11/08/2008
Reputação : 3
Número de Mensagens : 1121
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Re: Database Extension ( feito em c++ )
source code para quem quiser editar, melhorar ,seila
- Código:
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <ctime>
#define INT_CONST 0
#define DOUBLE_CONST 1
#define STRING_CONST 2
#define BYTE_CONST 3
#define BOOL_CONST 4
#define SHORT_CONST 5
#define FLOAT_CONST 6
using namespace std;
map<string,vector<int>*> IntMap;
map<string,vector<double>*> DoubleMap;
map<string,vector<unsigned char>*> ByteMap;
map<string,vector<unsigned char>*> BoolMap;
map<string,vector<string>*> StringMap;
map<string,vector<short>*> ShortMap;
map<string,vector<float>*> FloatMap;
#define DLLEXPORT extern "C" __declspec (dllexport)
void ClearInt()
{
map<string,vector<int>*>::iterator it;
for(it = IntMap.begin() ; it != IntMap.end() ; it++)
{
IntMap[it->first]->~vector();
}
IntMap.clear();
}
void ClearDouble()
{
map<string,vector<double>*>::iterator it;
for(it = DoubleMap.begin() ; it != DoubleMap.end() ; it++)
{
DoubleMap[it->first]->~vector();
}
DoubleMap.clear();
}
void ClearFloat()
{
map<string,vector<float>*>::iterator it;
for(it = FloatMap.begin() ; it != FloatMap.end() ; it++)
{
FloatMap[it->first]->~vector();
}
FloatMap.clear();
}
void ClearShort()
{
map<string,vector<short>*>::iterator it;
for(it = ShortMap.begin() ; it != ShortMap.end() ; it++)
{
ShortMap[it->first]->~vector();
}
ShortMap.clear();
}
void ClearString()
{
map<string,vector<string>*>::iterator it;
for(it = StringMap.begin() ; it != StringMap.end() ; it++)
{
StringMap[it->first]->~vector();
}
StringMap.clear();
}
void ClearByte()
{
map<string,vector<unsigned char>*>::iterator it;
for(it = ByteMap.begin() ; it != ByteMap.end() ; it++)
{
ByteMap[it->first]->~vector();
}
ByteMap.clear();
}
void ClearBool()
{
map<string,vector<unsigned char>*>::iterator it;
for(it = BoolMap.begin() ; it != BoolMap.end() ; it++)
{
BoolMap[it->first]->~vector();
}
BoolMap.clear();
}
void ClearAll()
{
ClearInt();
ClearDouble();
ClearString();
ClearByte();
ClearBool();
ClearShort();
ClearFloat();
}
int ReadInt(FILE* File,char* Buffer,int Count)
{
int len = strlen(Buffer);
char* Name = new char[len + 1];
strcpy(Name,Buffer);
Name[len] = '\0';
vector<int>* Vec = new vector<int>;
IntMap[Name] = Vec;
int P = len + 1;
for(int i = 0 ; i < Count ; i++)
{
int Read;
memcpy(&Read,&Buffer[P],4);
Vec->push_back(Read);
P+=4;
}
return P;
}
int ReadShort(FILE* File,char* Buffer,int Count)
{
int len = strlen(Buffer);
char* Name = new char[len + 1];
strcpy(Name,Buffer);
Name[len] = '\0';
vector<short>* Vec = new vector<short>;
ShortMap[Name] = Vec;
int P = len + 1;
for(int i = 0 ; i < Count ; i++)
{
short Read;
memcpy(&Read,&Buffer[P],2);
Vec->push_back(Read);
P+=2;
}
return P;
}
int ReadBool(FILE* File,char* Buffer,int Count)
{
int len = strlen(Buffer);
char* Name = new char[len + 1];
strcpy(Name,Buffer);
Name[len] = '\0';
vector<unsigned char>* Vec = new vector<unsigned char>;
BoolMap[Name] = Vec;
int P = len + 1;
for(int i = 0 ; i < Count ; i++)
{
unsigned char Read;
memcpy(&Read,&Buffer[P],1);
Vec->push_back(Read);
P+=1;
}
return P;
}
int ReadByte(FILE* File,char* Buffer,int Count)
{
int len = strlen(Buffer);
char* Name = new char[len + 1];
strcpy(Name,Buffer);
Name[len] = '\0';
vector<unsigned char>* Vec = new vector<unsigned char>;
ByteMap[Name] = Vec;
int P = len + 1;
for(int i = 0 ; i < Count ; i++)
{
unsigned char Read;
memcpy(&Read,&Buffer[P],1);
Vec->push_back(Read);
P+=1;
}
return P;
}
int ReadString(FILE* File,char* Buffer,int Count)
{
int len = strlen(Buffer);
char* Name = new char[len + 1];
strcpy(Name,Buffer);
Name[len] = '\0';
vector<string>* Vec = new vector<string>;
StringMap[Name] = Vec;
int P = len + 1;
for(int i = 0 ; i < Count ; i++)
{
int size = strlen(Buffer + P);
char* Read = new char[size + 1];
strncpy(Read,&Buffer[P],size);
Read[size] = '\0';
Vec->push_back(Read);
P+=size + 1;
}
return P;
}
int ReadDouble(FILE* File,char* Buffer,int Count)
{
int len = strlen(Buffer);
char* Name = new char[len + 1];
strcpy(Name,Buffer);
Name[len] = '\0';
vector<double>* Vec = new vector<double>;
DoubleMap[Name] = Vec;
int P = len + 1;
for(int i = 0 ; i < Count ; i++)
{
double Read;
memcpy(&Read,&Buffer[P],8);
Vec->push_back(Read);
P+=8;
}
return P;
}
int ReadFloat(FILE* File,char* Buffer,int Count)
{
int len = strlen(Buffer);
char* Name = new char[len + 1];
strcpy(Name,Buffer);
Name[len] = '\0';
vector<float>* Vec = new vector<float>;
FloatMap[Name] = Vec;
int P = len + 1;
for(int i = 0 ; i < Count ; i++)
{
float Read;
memcpy(&Read,&Buffer[P],4);
Vec->push_back(Read);
P+=4;
}
return P;
}
void WriteString(FILE* File)
{
map<string,vector<string>*>::iterator it;
char NuL = '\0';
for(it = StringMap.begin() ; it != StringMap.end() ; it++)
{
vector<string>* Vec = it->second;
unsigned char i = STRING_CONST;
unsigned short count = Vec->size();
string Name = it->first;
//Write Count
fwrite(&count,1,2,File);
//Write Type
fwrite(&i,1,1,File);
//Write Name
fwrite(Name.c_str(),1,Name.length(),File);
//Write NULL
fwrite(&NuL,1,1,File);
for(int i = 0 ; i < count ; i++)
{
fwrite(Vec->at(i).c_str(),1,Vec->at(i).length(),File);
fwrite(&NuL,1,1,File);
}
}
}
void WriteInt(FILE* File)
{
map<string,vector<int>*>::iterator it;
char NuL = '\0';
for(it = IntMap.begin() ; it != IntMap.end() ; it++)
{
vector<int>* Vec = it->second;
unsigned char i = INT_CONST;
unsigned short count = Vec->size();
string Name = it->first;
//Write Count
fwrite(&count,1,2,File);
//Write Type
fwrite(&i,1,1,File);
//Write Name
fwrite(Name.c_str(),1,Name.length(),File);
//Write NULL
fwrite(&NuL,1,1,File);
for(int i = 0 ; i < count ; i++)
{
fwrite(&Vec->at(i),1,4,File);
}
}
}
void WriteFloat(FILE* File)
{
map<string,vector<float>*>::iterator it;
char NuL = '\0';
for(it = FloatMap.begin() ; it != FloatMap.end() ; it++)
{
vector<float>* Vec = it->second;
unsigned char i = FLOAT_CONST;
unsigned short count = Vec->size();
string Name = it->first;
//Write Count
fwrite(&count,1,2,File);
//Write Type
fwrite(&i,1,1,File);
//Write Name
fwrite(Name.c_str(),1,Name.length(),File);
//Write NULL
fwrite(&NuL,1,1,File);
for(int i = 0 ; i < count ; i++)
{
fwrite(&Vec->at(i),1,4,File);
}
}
}
void WriteShort(FILE* File)
{
map<string,vector<short>*>::iterator it;
char NuL = '\0';
for(it = ShortMap.begin() ; it != ShortMap.end() ; it++)
{
vector<short>* Vec = it->second;
unsigned char i = SHORT_CONST;
unsigned short count = Vec->size();
string Name = it->first;
//Write Count
fwrite(&count,1,2,File);
//Write Type
fwrite(&i,1,1,File);
//Write Name
fwrite(Name.c_str(),1,Name.length(),File);
//Write NULL
fwrite(&NuL,1,1,File);
for(int i = 0 ; i < count ; i++)
{
fwrite(&Vec->at(i),1,2,File);
}
}
}
void WriteBool(FILE* File)
{
map<string,vector<unsigned char>*>::iterator it;
char NuL = '\0';
for(it = BoolMap.begin() ; it != BoolMap.end() ; it++)
{
vector<unsigned char>* Vec = it->second;
unsigned char i = INT_CONST;
unsigned short count = Vec->size();
string Name = it->first;
//Write Count
fwrite(&count,1,2,File);
//Write Type
fwrite(&i,1,1,File);
//Write Name
fwrite(Name.c_str(),1,Name.length(),File);
//Write NULL
fwrite(&NuL,1,1,File);
for(int i = 0 ; i < count ; i++)
{
fwrite(&Vec->at(i),1,1,File);
}
}
}
void WriteByte(FILE* File)
{
map<string,vector<unsigned char>*>::iterator it;
char NuL = '\0';
for(it = ByteMap.begin() ; it != ByteMap.end() ; it++)
{
vector<unsigned char>* Vec = it->second;
unsigned char i = BYTE_CONST;
int count = Vec->size();
string Name = it->first;
//Write Count
fwrite(&count,1,4,File);
//Write Type
fwrite(&i,1,1,File);
//Write Name
fwrite(Name.c_str(),1,Name.length(),File);
//Write NULL
fwrite(&NuL,1,1,File);
for(int i = 0 ; i < count ; i++)
{
fwrite(&Vec->at(i),1,1,File);
}
}
}
void WriteDouble(FILE* File)
{
map<string,vector<double>*>::iterator it;
char NuL = '\0';
for(it = DoubleMap.begin() ; it != DoubleMap.end() ; it++)
{
vector<double>* Vec = it->second;
unsigned char i = DOUBLE_CONST;
unsigned short count = Vec->size();
string Name = it->first;
//Write Count
fwrite(&count,1,2,File);
//Write Type
fwrite(&i,1,1,File);
//Write Name
fwrite(Name.c_str(),1,Name.length(),File);
//Write NULL
fwrite(&NuL,1,1,File);
for(int i = 0 ; i < count ; i++)
{
fwrite(&Vec->at(i),1,8,File);
}
}
}
DLLEXPORT double DataWrite(char* FileName)
{
clock_t Time = clock();
FILE* File;
File = fopen(FileName,"wb");
//WriteAll
WriteInt(File);
WriteDouble(File);
WriteString(File);
WriteByte(File);
WriteBool(File);
WriteShort(File);
WriteFloat(File);
// close
fclose(File);
return clock() - Time;
}
DLLEXPORT double DataLoad(char* FileName)
{
clock_t Time = clock();
FILE* File;
File = fopen(FileName,"rb");
if (File == NULL)
{
return -1;
}
fseek(File,0,SEEK_END);
int size = ftell(File);
char* Buffer = new char[size + 1];
rewind(File);
fread(Buffer,1,size,File);
ClearAll();
fclose(File);
// Read
int ReadPos = 0;
while(true)
{
if (ReadPos == size)
{
return clock() - Time;
}
unsigned short Size;
memcpy(&Size,Buffer + ReadPos,2);
ReadPos +=2;
unsigned char Type;
memcpy(&Type,Buffer + ReadPos,1);
ReadPos +=1;
switch(Type)
{
case INT_CONST:
ReadPos += ReadInt(File,Buffer + ReadPos,Size);
break;
case DOUBLE_CONST:
ReadPos += ReadDouble(File,Buffer + ReadPos,Size);
break;
case STRING_CONST:
ReadPos += ReadString(File,Buffer + ReadPos,Size);
break;
case BYTE_CONST:
ReadPos += ReadByte(File,Buffer + ReadPos,Size);
break;
case BOOL_CONST:
ReadPos +=ReadBool(File,Buffer + ReadPos,Size);
break;
case SHORT_CONST:
ReadPos += ReadShort(File,Buffer + ReadPos,Size);
break;
case FLOAT_CONST:
ReadPos += ReadFloat(File,Buffer + ReadPos,Size);
break;
}
}
//Do
return -1;
}
DLLEXPORT double DataCreateINT(char* Name)
{
if (IntMap.find(Name) == IntMap.end())
{
vector<int>* Vec = new vector<int>;
IntMap[Name] = Vec;
return 1;
}
return 0;
}
DLLEXPORT double DataCreateDOUBLE(char* Name)
{
if (DoubleMap.find(Name) == DoubleMap.end())
{
vector<double>* Vec = new vector<double>;
DoubleMap[Name] = Vec;
return 1;
}
return 0;
}
DLLEXPORT double DataCreateBYTE(char* Name)
{
if (ByteMap.find(Name) == ByteMap.end())
{
vector<unsigned char>* Vec = new vector<unsigned char>;
ByteMap[Name] = Vec;
return 1;
}
return 0;
}
DLLEXPORT double DataCreateSHORT(char* Name)
{
if (ShortMap.find(Name) == ShortMap.end())
{
vector<short>* Vec = new vector<short>;
ShortMap[Name] = Vec;
return 1;
}
return 0;
}
DLLEXPORT double DataCreateFLOAT(char* Name)
{
if (FloatMap.find(Name) == FloatMap.end())
{
vector<float>* Vec = new vector<float>;
FloatMap[Name] = Vec;
return 1;
}
return 0;
}
DLLEXPORT double DataCreateSTRING(char* Name)
{
if (StringMap.find(Name) == StringMap.end())
{
vector<string>* Vec = new vector<string>;
StringMap[Name] = Vec;
return 1;
}
return 0;
}
DLLEXPORT double DataAddINT(char* Name,double Add)
{
if (IntMap.find(Name) == IntMap.end())
{
return 0;
}
IntMap[Name]->push_back((int)Add);
return 1;
}
DLLEXPORT double DataAddFLOAT(char* Name,double Add)
{
if (FloatMap.find(Name) == FloatMap.end())
{
return 0;
}
FloatMap[Name]->push_back((float)Add);
return 1;
}
DLLEXPORT double DataAddDOUBLE(char* Name,double Add)
{
if (DoubleMap.find(Name) == DoubleMap.end())
{
return 0;
}
DoubleMap[Name]->push_back(Add);
return 1;
}
DLLEXPORT double DataAddBYTE(char* Name,double Add)
{
if (ByteMap.find(Name) == ByteMap.end())
{
return 0;
}
ByteMap[Name]->push_back((unsigned char)Add);
return 1;
}
DLLEXPORT double DataAddSHORT(char* Name,double Add)
{
if (ShortMap.find(Name) == ShortMap.end())
{
return 0;
}
ShortMap[Name]->push_back((short)Add);
return 1;
}
DLLEXPORT double DataAddSTRING(char* Name,char* Add)
{
if (StringMap.find(Name) == StringMap.end())
{
return 0;
}
StringMap[Name]->push_back(Add);
return 1;
}
DLLEXPORT double DataGetINT(char* Name,double ID)
{
if (IntMap.find(Name) == IntMap.end())
{
return -1;
}
unsigned int id = (unsigned int)ID;
vector<int>* Vec = IntMap[Name];
if (id >= Vec->size())
{
return -1;
}
return (double)Vec->at(id);
}
DLLEXPORT double DataGetDOUBLE(char* Name,double ID)
{
if (DoubleMap.find(Name) == DoubleMap.end())
{
return -1;
}
unsigned int id = (unsigned int)ID;
vector<double>* Vec = DoubleMap[Name];
if (id >= Vec->size())
{
return -1;
}
return Vec->at(id);
}
DLLEXPORT double DataGetBYTE(char* Name,double ID)
{
if (ByteMap.find(Name) == ByteMap.end())
{
return -1;
}
unsigned int id = (unsigned int)ID;
vector<unsigned char>* Vec = ByteMap[Name];
if (id >= Vec->size())
{
return -1;
}
return (double)Vec->at(id);
}
DLLEXPORT double DataGetSHORT(char* Name,double ID)
{
if (ShortMap.find(Name) == ShortMap.end())
{
return -1;
}
unsigned int id = (unsigned int)ID;
vector<short>* Vec = ShortMap[Name];
if (id >= Vec->size())
{
return -1;
}
return (double)Vec->at(id);
}
DLLEXPORT double DataGetFLOAT(char* Name,double ID)
{
if (FloatMap.find(Name) == FloatMap.end())
{
return -1;
}
unsigned int id = (unsigned int)ID;
vector<float>* Vec = FloatMap[Name];
if (id >= Vec->size())
{
return -1;
}
return (double)Vec->at(id);
}
DLLEXPORT char* DataGetSTRING(char* Name,double ID)
{
if (StringMap.find(Name) == StringMap.end())
{
return "";
}
unsigned int id = (unsigned int)ID;
vector<string>* Vec = StringMap[Name];
if (id >= Vec->size())
{
return "";
}
return const_cast<char*>(Vec->at(id).c_str());
}
DLLEXPORT double DataGetBOOL(char* Name,double ID)
{
if (BoolMap.find(Name) == BoolMap.end())
{
return -1;
}
unsigned int id = (unsigned int)ID;
vector<unsigned char>* Vec = BoolMap[Name];
if (id >= Vec->size())
{
return -1;
}
return (double)Vec->at(id);
}
DLLEXPORT double DataAddBOOL(char* Name,double Add)
{
if (BoolMap.find(Name) == BoolMap.end())
{
return 0;
}
if (Add == 0)
{
BoolMap[Name]->push_back(0);
}else{
BoolMap[Name]->push_back(1);
}
return 1;
}
DLLEXPORT double DataCreateBOOL(char* Name)
{
if (BoolMap.find(Name) == BoolMap.end())
{
vector<unsigned char>* Vec = new vector<unsigned char>;
BoolMap[Name] = Vec;
return 1;
}
return 0;
}
DLLEXPORT double DataFindINT(char* Name,double Value)
{
if (IntMap.find(Name) == IntMap.end())
{
return -1;
}
vector<int>* Vec = IntMap[Name];
vector<int>::iterator it;
int Find = (int)Value;
it = find(Vec->begin(),Vec->end(),Find);
if (it == Vec->end())
{
return -1;
}
return (*it) + 1;
}
DLLEXPORT double DataFindDOUBLE(char* Name,double Value)
{
if (DoubleMap.find(Name) == DoubleMap.end())
{
return -1;
}
vector<double>* Vec = DoubleMap[Name];
vector<double>::iterator it;
it = find(Vec->begin(),Vec->end(),Value);
if (it == Vec->end())
{
return -1;
}
return it - Vec->begin();
}
DLLEXPORT double DataFindSTRING(char* Name,char* Value)
{
if (StringMap.find(Name) == StringMap.end())
{
return -1;
}
vector<string>* Vec = StringMap[Name];
vector<string>::iterator it;
it = find(Vec->begin(),Vec->end(),Value);
if (it == Vec->end())
{
return -1;
}
return it - Vec->begin();
}
DLLEXPORT double DataFindBYTE(char* Name,double Value)
{
if (ByteMap.find(Name) == ByteMap.end())
{
return -1;
}
vector<unsigned char>* Vec = ByteMap[Name];
vector<unsigned char>::iterator it;
unsigned char Find = (unsigned char)Value;
it = find(Vec->begin(),Vec->end(),Find);
if (it == Vec->end())
{
return -1;
}
return it - Vec->begin();
}
DLLEXPORT double DataFindSHORT(char* Name,double Value)
{
if (ShortMap.find(Name) == ShortMap.end())
{
return -1;
}
vector<short>* Vec = ShortMap[Name];
vector<short>::iterator it;
short Find = (short)Value;
it = find(Vec->begin(),Vec->end(),Find);
if (it == Vec->end())
{
return -1;
}
return it - Vec->begin();
}
DLLEXPORT double DataFindFLOAT(char* Name,double Value)
{
if (FloatMap.find(Name) == FloatMap.end())
{
return -1;
}
vector<float>* Vec = FloatMap[Name];
vector<float>::iterator it;
float Find = (float)Value;
it = find(Vec->begin(),Vec->end(),Find);
if (it == Vec->end())
{
return -1;
}
return it - Vec->begin();
}
DLLEXPORT double DataReplaceINT(char* Name,double pos,double Value)
{
if (IntMap.find(Name) == IntMap.end())
{
return 0;
}
vector<int>* Vec = IntMap[Name];
Vec->at((int)pos) = (int)Value;
return 1;
}
DLLEXPORT double DataReplaceDOUBLE(char* Name,double pos,double Value)
{
if (DoubleMap.find(Name) == DoubleMap.end())
{
return 0;
}
vector<double>* Vec = DoubleMap[Name];
Vec->at((int)pos) = Value;
return 1;
}
DLLEXPORT double DataReplaceSTRING(char* Name,double pos,char* Value)
{
if (StringMap.find(Name) == StringMap.end())
{
return 0;
}
vector<string>* Vec = StringMap[Name];
Vec->at((int)pos) = Value;
return 1;
}
DLLEXPORT double DataReplaceBYTE(char* Name,double pos,double Value)
{
if (ByteMap.find(Name) == ByteMap.end())
{
return 0;
}
vector<unsigned char>* Vec = ByteMap[Name];
Vec->at((int)pos) = (unsigned char)Value;
return 1;
}
DLLEXPORT double DataReplaceBOOL(char* Name,double pos,double Value)
{
if (BoolMap.find(Name) == BoolMap.end())
{
return 0;
}
vector<unsigned char>* Vec = BoolMap[Name];
if (Value == 0)
{
Vec->at((int)pos) = 0;
}
else
{
Vec->at((int)pos) = 1;
}
return 1;
}
DLLEXPORT double DataReplaceSHORT(char* Name,double pos,double Value)
{
if (ShortMap.find(Name) == ShortMap.end())
{
return 0;
}
vector<short>* Vec = ShortMap[Name];
Vec->at((int)pos) = (short)Value;
return 1;
}
DLLEXPORT double DataReplaceFLOAT(char* Name,double pos,double Value)
{
if (FloatMap.find(Name) == FloatMap.end())
{
return 0;
}
vector<float>* Vec = FloatMap[Name];
Vec->at((int)pos) = (float)Value;
return 1;
}
DLLEXPORT double DataRemoveINT(char* Name,double pos)
{
if (IntMap.find(Name) == IntMap.end())
{
return 0;
}
vector<int>* Vec = IntMap[Name];
Vec->erase(Vec->begin() + (int)pos);
return 1;
}
DLLEXPORT double DataRemoveDOUBLE(char* Name,double pos)
{
if (DoubleMap.find(Name) == DoubleMap.end())
{
return 0;
}
vector<double>* Vec = DoubleMap[Name];
Vec->erase(Vec->begin() + (int)pos);
return 1;
}
DLLEXPORT double DataRemoveSTRING(char* Name,double pos)
{
if (StringMap.find(Name) == StringMap.end())
{
return 0;
}
vector<string>* Vec = StringMap[Name];
Vec->erase(Vec->begin() + (int)pos);
return 1;
}
DLLEXPORT double DataRemoveBYTE(char* Name,double pos)
{
if (ByteMap.find(Name) == ByteMap.end())
{
return 0;
}
vector<unsigned char>* Vec = ByteMap[Name];
Vec->erase(Vec->begin() + (int)pos);
return 1;
}
DLLEXPORT double DataRemoveBOOL(char* Name,double pos)
{
if (BoolMap.find(Name) == BoolMap.end())
{
return 0;
}
vector<unsigned char>* Vec = BoolMap[Name];
Vec->erase(Vec->begin() + (int)pos);
return 1;
}
DLLEXPORT double DataRemoveSHORT(char* Name,double pos)
{
if (ShortMap.find(Name) == ShortMap.end())
{
return 0;
}
vector<short>* Vec = ShortMap[Name];
Vec->erase(Vec->begin() + (int)pos);
return 1;
}
DLLEXPORT double DataRemoveFLOAT(char* Name,double pos)
{
if (FloatMap.find(Name) == FloatMap.end())
{
return 0;
}
vector<float>* Vec = FloatMap[Name];
Vec->erase(Vec->begin() + (int)pos);
return 1;
}
//
DLLEXPORT double DataSizeINT(char* Name)
{
if (IntMap.find(Name) == IntMap.end())
{
return -1;
}
vector<int>* Vec = IntMap[Name];
return (double)Vec->size();
}
DLLEXPORT double DataSizeDOUBLE(char* Name)
{
if (DoubleMap.find(Name) == DoubleMap.end())
{
return -1;
}
vector<double>* Vec = DoubleMap[Name];
return (double)Vec->size();
}
DLLEXPORT double DataSizeSTRING(char* Name)
{
if (StringMap.find(Name) == StringMap.end())
{
return -1;
}
vector<string>* Vec = StringMap[Name];
return (double)Vec->size();
}
DLLEXPORT double DataSizeBYTE(char* Name)
{
if (ByteMap.find(Name) == ByteMap.end())
{
return -1;
}
vector<unsigned char>* Vec = ByteMap[Name];
return (double)Vec->size();
}
DLLEXPORT double DataSizeBOOL(char* Name)
{
if (BoolMap.find(Name) == BoolMap.end())
{
return -1;
}
vector<unsigned char>* Vec = BoolMap[Name];
return (double)Vec->size();
}
DLLEXPORT double DataSizeSHORT(char* Name)
{
if (ShortMap.find(Name) == ShortMap.end())
{
return -1;
}
vector<short>* Vec = ShortMap[Name];
return (double)Vec->size();
}
DLLEXPORT double DataSizeFLOAT(char* Name)
{
if (FloatMap.find(Name) == FloatMap.end())
{
return -1;
}
vector<float>* Vec = FloatMap[Name];
return (double)Vec->size();
}
dungeon333- Data de inscrição : 29/05/2009
Reputação : 0
Número de Mensagens : 351
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos