logplus/DataMgr/include/CStringType.h
2025-10-30 13:38:13 +08:00

168 lines
3.8 KiB
C++

/**
* @file CStringTyle.h
* @brief CString数据自定义、井以及井次结构体
* @date 2014-10-10
* @author: ZhouWenfei
*/
#ifndef PAI_FRAME_CSTRING_H__
#define PAI_FRAME_CSTRING_H__
#pragma once
#include <iostream>
#include <QString>
#include <QMessageBox>
#include <QDialogButtonBox>
#include <QDialog>
#include <QFormLayout>
#include <QTextEdit>
#include <QDialogButtonBox>
#include <QFormLayout>
#include <QPushButton>
#include <stdio.h>
#include <limits.h>
#pragma execution_character_set("utf-8")
#pragma warning( push ,0)
//#include "BaseFunExport.h"
#pragma warning( pop )
//#ifdef MessageBox
//#define MessageBox MessageBox
//#endif
#define MAX_PATH 1024
//#define _MAX_PATH 1024
#define MaxCurve 1024
#define curve_name_len 256
#define curve_unit_len 256
#define MIN_RANK rank_char
#define MAX_RANK rank_longlong
#define INTMAX_RANK rank_longlong
#define SIZE_T_RANK rank_long
#define PTRDIFF_T_RANK rank_long
#define MB_OK QMessageBox::Ok
typedef unsigned short WORD;
#ifdef WIN32
typedef unsigned long DWORD;
typedef DWORD *LPDWORD;
typedef void *HANDLE;
#else
typedef unsigned int DWORD;
typedef DWORD *LPDWORD;
typedef void *HANDLE;
#endif
typedef unsigned char BYTE;
typedef char* LPSTR;
typedef void* LPVOID;
class CString;
typedef QList<CString> CStringList;
using namespace std;
//#define REPR_INT 1
//#define REPR_SHORT 2
//#define REPR_LONG 3
//#define REPR_FLOAT 4
//#define REPR_DOUBLE 5
//#define REPR_STRING 6
//#define REPR_CHAR 7
//#define REPR_UCHAR 8
//#define REPR_USHORT 9
//#define REPR_UINT 10
//#define REPR_ULONG 11
//class BASEFUN_EXPORT CString;
//构建CString
class CString
{
public:
CString(const char *str = nullptr);
CString(const QString str);
CString(const CString &other);
~CString();
int GetLength()const;
int Find(char *str);
int Find(char str);
int Find(CString &another);
int Find(char str[],int start);
int ReverseFind(char ch);
int Insert(int pos ,const CString Sctr);
int Replace(const char *Src,const char *Dest);
CString & TrimLeft();
CString & MakeUpper();
CString& MakeLower();
CString & TrimRight();
bool operator==(const char* other );
bool operator!=(const char* other );
bool operator==(const CString& other );
bool operator!=(const CString& other );
char operator[](int i);
CString Right(int count)const;
CString Left(int count)const;
// CString operator = (const QString& SrcStr) ;
CString operator + (const CString& SrcStr) ;
CString operator += (CString& SrcStr) ;
CString operator += (const CString& SrcStr) ;
char* GetString()const;
char GetChar(int n);
char GetAt(int n);
CString Mid(int pos,int count)const;
CString Mid(int pos)const;
void Format(const char *format,...);
void Delete(int fromIndex,int length);
// const char *m_temp;
void Alloc(int len);
void Empty();
private:
QString m_data;
};
enum flags {
FL_SPLAT0 = 0x00,/* Drop the value, do not assign */
FL_SPLAT = 0x01,/* Drop the value, do not assign */
FL_INV = 0x02,/* Character-set with inverse */
FL_WIDTH = 0x04,/* Field width specified */
FL_MINUS = 0x08,/* Negative number */
};
enum ranks {
rank_char = -2,
rank_short = -1,
rank_int = 0,
rank_long = 1,
rank_longlong = 2,
rank_ptr = INT_MAX/* Special value used for pointers */
};
enum bail {
bail_none = 0,/* No error condition */
bail_eof,/* Hit EOF */
bail_err/* Conversion mismatch */
};
int AfxMessageBox(CString str);
int MessageBox(QWidget *parent,char lpText[128],char*lpCaption, int UINTuType);
void ShowMessage(QString mess);
//构建AfxMessageBox()函数
//extern int BASEFUN_EXPORT AfxMessageBox(CString str);
//extern int BASEFUN_EXPORT MessageBox(QWidget *parent,char lpText[128],char*lpCaption, int UINTuType);
// using namespace pai::graphics;
#endif