class colors
{
public:
colors();
~colors();
int getRed(int num);
enum{max_colors=17};
private:
struct ColorData
{
int num;
int R;
int G;
int B;
}Propiedades[max_colors],*p;
};
class colors
{
public:
colors();
~colors();
int getRed(int num);
enum{max_colors=17};
private:
struct ColorData
{
int num;
QString name;
int R;
int G;
int B;
}Propiedades[max_colors],*p;
};
To copy to clipboard, switch view to plain text mode
#include "colors.h"
colors::colors()
{
ColorData Propiedades[max_colors] =
{
{ 0, "black", 0, 0, 0},
{ 1, "white",255,255,255},
{ 2, "darkGray",128,128,128},
{ 3, "gray",160,160,164},
...
};
p=&Propiedades[0];
}
int colors::getRed(int num)
{
ColorData *q;
q=p;
for (int i=0;i<=max_colors;i++){
if (num==q->num) return q->R;
q++;
}
return 0;
}
#include "colors.h"
colors::colors()
{
ColorData Propiedades[max_colors] =
{
{ 0, "black", 0, 0, 0},
{ 1, "white",255,255,255},
{ 2, "darkGray",128,128,128},
{ 3, "gray",160,160,164},
...
};
p=&Propiedades[0];
}
int colors::getRed(int num)
{
ColorData *q;
q=p;
for (int i=0;i<=max_colors;i++){
if (num==q->num) return q->R;
q++;
}
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks