首页 > 代码库 > The Foundation Framework 百度翻译
The Foundation Framework 百度翻译
The Foundation framework defines a base layer of Objective-C classes. In addition to providing a set of useful primitive object classes, it introduces several paradigms that define functionality not covered by the Objective-C language. The Foundation framework is designed with these goals in mind:
Foundation定义了Objective-C基础层的东西。除了提供了一组有用的原始对象类,Objective-C语言之外,它还带来了几个定义功能的规范。Foundation的设计有如下这些目标:
- Provide a small set of basic utility classes.提供一系列基本工具类。
- Make software development easier by introducing consistent conventions for things such as deallocation.通过引入一致的约定,比如内存释放,使软件开发更容易。
- Support Unicode strings, object persistence, and object distribution.支持Unicode字符串、对象持久化、对象分布。
- Provide a level of OS independence, to enhance portability.提供一个独立的操作系统,以提高可移植性。
The Foundation framework includes the root object class, classes representing basic data types such as strings and byte arrays, collection classes for storing other objects, classes representing system information such as dates, and classes representing communication ports. See Cocoa Objective-C Hierarchy for Foundation for a list of those classes that make up the Foundation framework.
Foundation框架包括根对象类,代表基本数据类型,如字符串、字节数组、用于存储其他对象的集合类、表示系统信息的如日期类,和代表通信端口的类。看看Cocoa Objective-C for Foundation的层次结构,一系列的这些类,组成了Foundation框架。
The Foundation framework introduces several paradigms to avoid confusion in common situations, and to introduce a level of consistency across class hierarchies. This consistency is done with some standard policies, such as that for object ownership (that is, who is responsible for disposing of objects), and with abstract classes like NSEnumerator. These new paradigms reduce the number of special and exceptional cases in an API and allow you to code more efficiently by reusing the same mechanisms with various kinds of objects.
Foundation介绍了几种规范来避免混乱和常见的情况,介绍一种水平的跨类层次结构的一致性。这种一致性是做了一些标准的政策,例如,对象的所有权(即,谁负责释放对象),以及NSEnumerator抽象类。这些新的模式减少了API中专用和异常的数量,然后通过重复使用各种类型对象的相同机制,让你编码起来更高效。
Foundation Framework Classes
The Foundation class hierarchy is rooted in the Foundation framework’s NSObject class.
Foundation的层次结构是基于NSObject类的。
The remainder of the Foundation framework consists of several related groups of classes as well as a few individual classes.
Foundation的其余部分由几组相关类及几个特殊类组成。
Many of the groups form what are called class clusters—abstract classes that work as umbrella interfaces to a versatile set of private subclasses.
许多组织形式被称为簇类的抽象类作为接口的子类伞私人通用设置。
NSString and NSMutableString, for example, act as brokers for instances of various private subclasses optimized for different kinds of storage needs.
例如,NSString和NSMutableString,充当中间人,优化了各种私有子类的存储。
Depending on the method you use to create a string, an instance of the appropriate optimized class will be returned to you.
使用不同的方法创建字符串,将返回一个适当优化过的实例。
Many of these classes have closely related functionality: 许多这些类功能密切相关:
Data storage. 数据存储相关。
NSData and NSString provide object-oriented storage for arrays of bytes.
NSData和NSString提供了字符串、字节集的面向对象存储。
NSValue and NSNumber provide object-oriented storage for arrays of simple C data values.
NSValue和NSNumber提供了的C基本数据类型数组的面向对象存储。
NSArray, NSDictionary, and NSSet provide storage for Objective-C objects of any class.
NSArray、NSDictionary和NSSet为任意Objective-C对象提供存储。
Text and strings. 文本和字符串相关。
NSCharacterSet represents various groupings of characters that are used by the NSString and NSScanner classes.
NSCharacterSet代表被NSString和NSScanner所使用的各种字符。
The NSString classes represent text strings and provide methods for searching, combining, and comparing strings.
NSString类代表文本字符串,同时还提供了字符串的搜索、结合、比较等等一些方法。
An NSScanner object is used to scan numbers and words from an NSString object.
NSScanner对象用于扫描字符串的字数和词数等等。
Dates and times.
日期和时间相关。
The NSDate, NSTimeZone, and NSCalendar classes store times and dates and represent calendrical information.
NSDate、NSTimeZone和NSCalendar存储日期、时间,和表示日历信息。
They offer methods for calculating date and time differences.
它们提供计算日期和时间差的方法。
Together with NSLocale, they provide methods for displaying dates and times in many formats, and for adjusting times and dates based on location in the world.
它们和NSLocale一起,提供许多方法来显示各种格式的日期和时间,和基于时区的调节。
Application coordination and timing.
应用协调和时间。
NSNotification, NSNotificationCenter, and NSNotificationQueue provide systems that an object can use to notify all interested observers of changes that occur.
NSNotification、NSNotificationCenter和NSNotificationQueue提供一个系统,一个对象可以使用通知发生的变化,所有感兴趣的观察员。
You can use an NSTimer object to send a message to another object at specific intervals.
您可以使用NSTimer对象以一定的时间间隔给另一个对象发送消息。
Object creation and disposal.
对象的创建和销毁。
NSAutoreleasePool is used to implement the delayed-release feature of the Foundation framework.
NSAutoreleasePool用来实现Foundation的“延迟回收”特性。
Object distribution and persistence.
对象的分布和持久化。
The data that an object contains can be represented in an architecture-independent way using NSPropertyListSerialization.
一个对象包含的数据,可以用NSPropertyListSerialization的体系结构无关的方式代表。
The NSCoder and its subclasses take this process a step further by allowing class information to be stored along with the data.
NSCoder和它的子类因为允许类信息随着数据存储,让这个过程又更进一步。
The resulting representations are used for archiving and for object distribution.
得到的表示是用于存储与对象的分布。
Operating-system services.
操作系统级服务。
Several classes are designed to insulate you from the idiosyncrasies of various operating systems.
有几个类设计来让您摆脱各种操作系统的差异。
NSFileManager provides a consistent interface for file operations (creating, renaming, deleting, and so on).
NSFileManager为文件操作提供了一致的接口(创建,重命名,删除,等等)。
NSThread and NSProcessInfo let you create multithreaded applications and query the environment in which an application runs.
NSThread和NSProcessInfo让您创建多线程应用程序,和查询应用程序运行时环境。
URL loading system.
URL加载系统。
A set of classes and protocols provide access to common Internet protocols.
一组类和协议,提供对一般网络协议的访问。
The Foundation Framework 百度翻译