⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sgxbarcode.hpp

📁 一个基于BREW上的WEB service程序,通过扫描图书的条形码,登陆WEB站点,利用SOAP-RPC来查询图书信息.
💻 HPP
字号:
/**
***     Class Name                     : SGXBarCode
***     Version                        : 1.0.0
***
***     Author                         : Sophia Cradle Incorporated
***     Platform                       : x86, ARM
***     OS                             : BREW 2.1, BREW 3.1
***     Target SophiaFramework Version : 3.0
***     Compiler                       : Visual C++ 6.0, Visual C++ .NET 2003,
***                                      RVCTB 1.2
**/

#ifndef __SOPHIACRADLE_SGXBARCODE_HPP
#define __SOPHIACRADLE_SGXBARCODE_HPP

#include <SophiaFramework.hpp>
#include "SGXBitmap.hpp"

typedef Float32 SGXBARCODE_FLOAT;

SFMTYPEDEFCLASS(SGXBarCode)
class SGXBarCode : public static_exception<SFCError> {
public:
    enum BarCodeEnum {
        BARCODE_JAN8 = 0,       // JAN-8 僶乕僐乕僪
        BARCODE_JAN13,          // JAN-13 僶乕僐乕僪
        BARCODE_LIMIT
    };
    enum {
        ERR_INVALID_BARCODE = 0x9000,   // 晄揔愗側僶乕僐乕僪
        ERR_MISMATCH = 0x9001           // 僨乕僞晄惍崌
    };
private:
    enum BarTypeEnum {
        BARTYPE_JAN_LO = 0,
        BARTYPE_JAN_LE,
        BARTYPE_JAN_RE,
        BARTYPE_LIMIT
    };
    typedef struct STRUCT_BAR {
        Bool isWhite;
        SInt32 barLeft;
        SInt32 barRight;
    } TYPE_STRUCT_BAR;
    BarCodeEnum _barcodeType;
    SInt16 _barBitSize;
    BoolPtr _barBit;
    SFXAnsiString _result;
    UInt16 _height;
    SInt32 _grayscaleWidth;
    SInt32 _grayscaleHeight;
    UInt08Ptr _grayscale;

public:
    explicit SGXBarCode(Void);
    explicit SGXBarCode(BarCodeEnum barcodeType);
    explicit SGXBarCode(SGXBarCodeConstRef ob) static_throws;
    virtual ~SGXBarCode(Void);
    virtual SGXBarCodeConstRef operator =(SGXBarCodeConstRef ob) static_throws;
    Void SetType(BarCodeEnum barcodeType);
    BarCodeEnum GetType(Void) const;
    Void SetHeight(UInt16 height);
    UInt16 GetHeight(Void) const;
    SFXAnsiStringConstRef Read(SFBBitmapSmpConstRef bitmap) static_throws;
    SFXAnsiStringConstRef Read(SFBBitmapSmpConstRef bitmap, UInt16 y) static_throws;
    SFXAnsiStringConstRef GetResult(Void) const;
private:
    Void Clear(Void);
    Void Copy(SGXBarCodeConstRef ob) static_throws;
    Void ProcessJAN13(Void) static_throws;
    Void ProcessJAN8(Void) static_throws;
    static Bool ReadJANBar(BoolConstPtr bar, UInt08Ptr pVal, BarTypeEnum *pBarType);
    Void CreateGrayScale(SFBBitmapSmpConstRef bitmap, UInt16 y) static_throws;
    Void CreateBarBit(Void) static_throws;
    static UInt08 GetThreshold(UInt08ConstPtr pGray, SInt32 size);
    Bool SearchLeftRight(SInt32Ptr pLeft, SInt32Ptr pRight) const;
    static Bool SearchLeftRightJAN(UInt08ConstPtr pGray, SInt32 width, UInt08 threshold, SInt32Ptr pLeft, SInt32Ptr pRight);
    SInt32 ToIndex(SInt32 x, SInt32 y) const;
    static SGXBARCODE_FLOAT Sqr(SGXBARCODE_FLOAT x);
};

inline SInt32 SGXBarCode::ToIndex(SInt32 x, SInt32 y) const
{
    return y * _grayscaleWidth + x;
}

inline SGXBARCODE_FLOAT SGXBarCode::Sqr(SGXBARCODE_FLOAT x)
{
    return x * x;
}

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -