Haxe 标准库简介¶
参考:https://haxe.org/documentation/introduction/stdlib-introduction.html
Haxe 标准库提供了通用的工具,而不是试图成为数据结构和算法的详尽集合。Haxe 发行版附带一个包含 Haxe 标准库的 std 目录。它的内容可以这样分类:
一般用途:
std
目录本身包含一些顶级类,如Array
、Map
或String
,它们可以用于所有目标。haxe
子目录提供额外的数据结构、输入/输出 api 和更多工具。系统:子目录
sys
包含与文件系统和数据库相关的 api。此外,Sys
顶级类允许与操作系统进行各种交互。它们只能在编译到sys
类的目标(C++, C#, Java, Neko, PHP)时被访问。特定于目标:每个 Haxe 目标有一个不同的子目录,其中包含特定于目标的 api。只有在编译到给定目标时才能访问它们。
一般用途¶
对所有目标可用。
最高阶层的:
Array:类型化集合,它定义了几个符合 ECMA 的操作
Date, DateTools:与日期和时间戳相关的操作
EReg:正则表达式
Lambda: Operations over iterables
Map: Key-to-value mapping data structure
Math: ECMA-compliant mathematical functions
Reflect: Field-related reflection
Std: Runtime type-checking; numerical parsing; conversion to Int and String
String: Basic operations on String
StringBuf: Optimized for building Strings
StringTools: Various extensions to String
Type: Type-related reflection
Xml: Cross-platform XML
haxe
包:
haxe.Http: HTTP requests
haxe.Json: Encoding and decoding JSON
haxe.Resource: Work with Haxe resources
haxe.Serializer: Serialize arbitrary objects as String
haxe.Template: Simple templating system
haxe.Timer: Repeated/delayed execution; measuring
haxe.Unserializer: Complement to haxe.Serializer
haxe.UnicodeString: Cross-platform unicode strings
haxe.crypto: Various encryption algorithms
haxe.macro: Types for working with Haxe macros
haxe.MainLoop: MainLoop for Haxe
haxe.rtti: Run-time type information
haxe.xml: Complementary XML tools
haxe.zip: Support of the ZIP-format
haxe.ds
包:
haxe.ds.ArraySort: Stable, cross-platform array sorting
haxe.ds.BalancedTree: Balanced tree data structure
haxe.ds.EnumValueMap: Map type supporting enum value keys
haxe.ds.GenericStack: Stack data structure which is optimized on static targets
haxe.ds.IntMap: Map type supporting Int keys
haxe.ds.ObjectMap: Map type supporting object keys
haxe.ds.StringMap: Map type supporting string keys
haxe.ds.Vector: Fixed-size data structure
haxe.io
包:
haxe.io.Bytes: Byte operations on native representations
haxe.io.BytesBuffer: Optimized for building Bytes
haxe.io.Path: Operations on path strings
系统 API¶
可在 C++,C#, Java, Neko 和 PHP。
Sys: Execute native commands; interact with stdin, stdout and stderr; various other native operations
sys.FileSystem: Read and modify directories; obtain information on files and directories
sys.db: APIs for working with MySQL and SQLite databases
sys.io.File: Read and write file content; copy files
sys.io.Process: Use native processes
sys.thread: API for multi-threaded applications.
目标特定 API¶
cpp:
js:
js.Lib: Provides some platform-specific functions for the JavaScript target.
js.Browser: Shortcuts for common browser functions.
js.html: Externs for interacting with the native JavaScript API’s / DOM.
js.html: Helper for low-level JavaScript specific code generation.
php:
php.Lib: Provides platform-specific functions for the PHP target.
php.Syntax: Helper for low-level PHP specific code generation.
php.Session: Work with native PHP sessions
php.Web: Work with HTTP requests and responses
php.db.PDO: Additional PDO driver for database interactions
cs: API for C# target
java: API for Java target
-
python.Lib: Provides platform-specific functions for the Python target.
python.Syntax: Helper for low-level Python specific code generation.
python.Syntax: Externs for interacting with native Python classes.
-
flash.Lib Provides platform-specific functions for the Flash target.
flash.Memory Extern for Flash Memory API
flash.Vector Extern for Flash Vectors
neko:
hl: Low level interactions with the HashLink target
lua: Low level interactions with the lua target