-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
184 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/*! @file */ | ||
/* | ||
Copyright (C) 2018-2021, Sakura Editor Organization | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
arising from the use of this software. | ||
Permission is granted to anyone to use this software for any purpose, | ||
including commercial applications, and to alter it and redistribute it | ||
freely, subject to the following restrictions: | ||
1. The origin of this software must not be misrepresented; | ||
you must not claim that you wrote the original software. | ||
If you use this software in a product, an acknowledgment | ||
in the product documentation would be appreciated but is | ||
not required. | ||
2. Altered source versions must be plainly marked as such, | ||
and must not be misrepresented as being the original software. | ||
3. This notice may not be removed or altered from any source | ||
distribution. | ||
*/ | ||
#include "StdAfx.h" | ||
#include "CUchardet.h" | ||
|
||
/*! | ||
* @brief DLLの名前を返す | ||
*/ | ||
LPCWSTR CUchardet::GetDllNameImp( [[maybe_unused]] int index ) | ||
{ | ||
return L"uchardet.dll"; | ||
} | ||
|
||
/*! | ||
DLLの初期化 | ||
関数のアドレスを取得してメンバに保管する. | ||
@retval true 成功 | ||
@retval false アドレス取得に失敗 | ||
*/ | ||
bool CUchardet::InitDllImp() | ||
{ | ||
// DLL内関数名リスト | ||
const ImportTable table[] = { | ||
{ &_uchardet_new, "uchardet_new" }, | ||
{ &_uchardet_delete, "uchardet_delete" }, | ||
{ &_uchardet_handle_data, "uchardet_handle_data" }, | ||
{ &_uchardet_data_end, "uchardet_data_end" }, | ||
{ &_uchardet_reset, "uchardet_reset" }, | ||
{ &_uchardet_get_charset, "uchardet_get_charset" }, | ||
{ nullptr, 0 } | ||
}; | ||
return RegisterEntries(table); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/*! @file */ | ||
/* | ||
Copyright (C) 2018-2021, Sakura Editor Organization | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
arising from the use of this software. | ||
Permission is granted to anyone to use this software for any purpose, | ||
including commercial applications, and to alter it and redistribute it | ||
freely, subject to the following restrictions: | ||
1. The origin of this software must not be misrepresented; | ||
you must not claim that you wrote the original software. | ||
If you use this software in a product, an acknowledgment | ||
in the product documentation would be appreciated but is | ||
not required. | ||
2. Altered source versions must be plainly marked as such, | ||
and must not be misrepresented as being the original software. | ||
3. This notice may not be removed or altered from any source | ||
distribution. | ||
*/ | ||
#pragma once | ||
|
||
#include "CDllHandler.h" | ||
|
||
typedef struct uchardet * uchardet_t; | ||
|
||
/*! | ||
* uchardet ライブラリ(uchardet.dll) をラップするクラス | ||
*/ | ||
class CUchardet final : public CDllImp | ||
{ | ||
public: | ||
// DLL関数ポインタ | ||
uchardet_t (*_uchardet_new)(void) = nullptr; | ||
void (*_uchardet_delete)(uchardet_t ud) = nullptr; | ||
int (*_uchardet_handle_data)(uchardet_t ud, const char * data, size_t len) = nullptr; | ||
void (*_uchardet_data_end)(uchardet_t ud) = nullptr; | ||
void (*_uchardet_reset)(uchardet_t ud) = nullptr; | ||
const char * (*_uchardet_get_charset)(uchardet_t ud) = nullptr; | ||
|
||
protected: | ||
// CDllImpインタフェース | ||
LPCWSTR GetDllNameImp(int nIndex) override; | ||
bool InitDllImp() override; | ||
|
||
public: | ||
uchardet_t uchardet_new(void) const { return _uchardet_new(); } | ||
void uchardet_delete(uchardet_t ud) const { _uchardet_delete(ud); } | ||
int uchardet_handle_data(uchardet_t ud, const char * data, size_t len) const { return _uchardet_handle_data(ud, data, len); } | ||
void uchardet_data_end(uchardet_t ud) const { _uchardet_data_end(ud); } | ||
void uchardet_reset(uchardet_t ud) const { _uchardet_reset(ud); } | ||
const char * uchardet_get_charset(uchardet_t ud) const { return _uchardet_get_charset(ud); } | ||
}; | ||
|