GMBR
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.
Entrar

Esqueci-me da senha

Últimos assuntos
» Colisões não funcionando
por RastaMaan Ontem à(s) 19:49

» Como ajustar velocidade de cada frame da animação no game maker
por pequetux Ontem à(s) 16:45

» Preciso de ajuda
por AftonDuGrau Dom 21 Abr 2024, 20:18

» Como faz o evento drawn GUI, não se repetir?
por aminaro Sex 19 Abr 2024, 20:30

» PROBLEMAS COM FÍSICAS DE ÁGUA
por aminaro Ter 16 Abr 2024, 10:07

» Retorno da GMBR!!!
por Ralphed Sex 12 Abr 2024, 22:45

» JOGADOR PARANDO NO AR QUANDO ATACA
por aminaro Qua 10 Abr 2024, 13:51

» Problemas com texto interativo
por Kaaru72 Dom 07 Abr 2024, 11:31

» Erro escondido e indecifrável
por dev_gabize.azv Qui 04 Abr 2024, 10:11

» Mudar cor de apenas uma palavra
por Ralphed Sáb 30 Mar 2024, 00:39

» Procuro Programador de game maker
por Wou Sex 15 Mar 2024, 10:27

» Mod APK
por gamerainha Qua 13 Mar 2024, 06:30

» Aceito pedidos de sprites (Com exemplos meus)
por Sevilha Qua 28 Fev 2024, 12:17

» Inventário simples
por Isquilo_Roedor Qui 22 Fev 2024, 15:18

» Problemas na programaçnao de inimigo [jogo DOOM LIKE]
por Black Mirror Dom 11 Fev 2024, 13:34

» ANDROID MULTI TOUCH
por DiegoBr Dom 04 Fev 2024, 12:13

» Servidor de Discord do fórum?
por Lighter Sáb 27 Jan 2024, 17:18

» Save e Load Json
por Klinton Rodrigues Qui 25 Jan 2024, 11:12

» Colisão com mais de um objeto
por aminaro Seg 22 Jan 2024, 15:02

» Oi sou novo aqui
por Thiago Silveira Alexandre Sáb 20 Jan 2024, 20:55

» Como acessar conteudo comprado no marketplace
por macmilam Sex 19 Jan 2024, 07:42

» Devlogs em vídeos do Block Room
por Joton Seg 15 Jan 2024, 16:56

» Alguém aqui já ganha dinheiro com seus games?
por Joton Seg 15 Jan 2024, 16:49

» ACERVO GMBR MAGAZINE
por Joton Qui 11 Jan 2024, 19:21

» como aumentar o obj sem aumentar a colisão??
por GabrielXavier Qua 10 Jan 2024, 07:21


Database Extension ( feito em c++ )

2 participantes

Ir para baixo

Database Extension ( feito em c++ ) Empty Database Extension ( feito em c++ )

Mensagem por dungeon333 Sáb 27 Mar 2010, 22:16

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

}
avatar
dungeon333

Data de inscrição : 29/05/2009
Reputação : 0
Número de Mensagens : 351
Prêmios : Database Extension ( feito em c++ ) Empty

Medalhas x 0 Tutoriais x 0 Moedas x 0

Ouro x 0 Prata x 0 Bronze x 0

Insignia 1 x 0 Insignia 2 x 0 Insignia 3 x 0

Ir para o topo Ir para baixo

Database Extension ( feito em c++ ) Empty Re: Database Extension ( feito em c++ )

Mensagem por tata139 Sáb 27 Mar 2010, 22:43

PRA QUE ISSO SERVE? Mesmo assim, Baixando Happy ja dou um edit
tata139
tata139

Data de inscrição : 11/08/2008
Reputação : 3
Número de Mensagens : 1121
Prêmios : Database Extension ( feito em c++ ) Empty

Medalhas x 0 Tutoriais x 0 Moedas x 0

Ouro x 0 Prata x 0 Bronze x 0

Insignia 1 x 0 Insignia 2 x 0 Insignia 3 x 0

Ir para o topo Ir para baixo

Database Extension ( feito em c++ ) Empty Re: Database Extension ( feito em c++ )

Mensagem por dungeon333 Sáb 27 Mar 2010, 22:56

tata139 escreveu:PRA QUE ISSO SERVE? Mesmo assim, Baixando Happy ja dou um edit
serve para criar banco de dados para salvar informaçoes;igual arquivos INI só que e bem + rapido
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;
avatar
dungeon333

Data de inscrição : 29/05/2009
Reputação : 0
Número de Mensagens : 351
Prêmios : Database Extension ( feito em c++ ) Empty

Medalhas x 0 Tutoriais x 0 Moedas x 0

Ouro x 0 Prata x 0 Bronze x 0

Insignia 1 x 0 Insignia 2 x 0 Insignia 3 x 0

Ir para o topo Ir para baixo

Database Extension ( feito em c++ ) Empty Re: Database Extension ( feito em c++ )

Mensagem por tata139 Sáb 27 Mar 2010, 23:12

=O Mto bom, agora vai ser mais facil de fazer traduções! e sem travar!
tata139
tata139

Data de inscrição : 11/08/2008
Reputação : 3
Número de Mensagens : 1121
Prêmios : Database Extension ( feito em c++ ) Empty

Medalhas x 0 Tutoriais x 0 Moedas x 0

Ouro x 0 Prata x 0 Bronze x 0

Insignia 1 x 0 Insignia 2 x 0 Insignia 3 x 0

Ir para o topo Ir para baixo

Database Extension ( feito em c++ ) Empty Re: Database Extension ( feito em c++ )

Mensagem por dungeon333 Dom 28 Mar 2010, 17:03

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();
}
avatar
dungeon333

Data de inscrição : 29/05/2009
Reputação : 0
Número de Mensagens : 351
Prêmios : Database Extension ( feito em c++ ) Empty

Medalhas x 0 Tutoriais x 0 Moedas x 0

Ouro x 0 Prata x 0 Bronze x 0

Insignia 1 x 0 Insignia 2 x 0 Insignia 3 x 0

Ir para o topo Ir para baixo

Database Extension ( feito em c++ ) Empty Re: Database Extension ( feito em c++ )

Mensagem por Conteúdo patrocinado


Conteúdo patrocinado


Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos