All Projects → scramjet → Mpedn

scramjet / Mpedn

Licence: epl-1.0
EDN I/O library for Objective-C (MacOS and iOS)

Labels

Projects that are alternatives of or similar to Mpedn

Fluentui Apple
UIKit and AppKit controls for building native Microsoft experiences
Stars: ✭ 459 (+1539.29%)
Mutual labels:  cocoa
Xit
Mac OS X Git GUI
Stars: ✭ 700 (+2400%)
Mutual labels:  cocoa
Privilegedtaskrunner
Swift 4 example code for creating privileged helpers in macOS
Stars: ✭ 19 (-32.14%)
Mutual labels:  cocoa
Midiapps
MIDI apps for Mac OS X: MIDI Monitor and SysEx Librarian.
Stars: ✭ 488 (+1642.86%)
Mutual labels:  cocoa
Orsserialport
Serial port library for Objective-C and Swift macOS apps
Stars: ✭ 609 (+2075%)
Mutual labels:  cocoa
Nswindowstyles
A showcase of the many different styles of windows possible with NSWindow on macOS
Stars: ✭ 801 (+2760.71%)
Mutual labels:  cocoa
Coast
The fullest full stack clojure web framework
Stars: ✭ 442 (+1478.57%)
Mutual labels:  edn
Objc Uti
Objective-C wrapper for Uniform Type Identifiers (UTIs)
Stars: ✭ 7 (-75%)
Mutual labels:  cocoa
Latest
A small utility app for macOS that makes sure you know about all the latest updates to the apps you use.
Stars: ✭ 657 (+2246.43%)
Mutual labels:  cocoa
Jcggcolorslider
Colorful NSSlider subclass
Stars: ✭ 19 (-32.14%)
Mutual labels:  cocoa
Brisk
✨Cross-platform set of tools for building native UIs with Reason/OCaml
Stars: ✭ 518 (+1750%)
Mutual labels:  cocoa
Strongbox
A KeePass/Password Safe Client for iOS and OS X
Stars: ✭ 586 (+1992.86%)
Mutual labels:  cocoa
Wfcolorcode
NSColor extension adding ability to handle HSL color space and CSS3 style color codes
Stars: ✭ 16 (-42.86%)
Mutual labels:  cocoa
Swiftai
SwiftAI, write Swift code smart. SwiftAI can generate Model class from JSON now. Codable and HandyJSON is supported. More features will be add.
Stars: ✭ 470 (+1578.57%)
Mutual labels:  cocoa
Mgkmenuwithfilter
A macOS menu that supports items filtration via keyboard input
Stars: ✭ 26 (-7.14%)
Mutual labels:  cocoa
Fipp
Fast Idiomatic Pretty Printer for Clojure
Stars: ✭ 454 (+1521.43%)
Mutual labels:  edn
Scrooge
A Thrift parser/generator
Stars: ✭ 724 (+2485.71%)
Mutual labels:  cocoa
Tablebinding
Swift NSTableView bound to an NSArrayController
Stars: ✭ 8 (-71.43%)
Mutual labels:  cocoa
Nippy
High-performance serialization library for Clojure
Stars: ✭ 838 (+2892.86%)
Mutual labels:  edn
Cocoaheads Ukraine
Collection of talks given at the CocoaHeads Ukraine meetups.
Stars: ✭ 18 (-35.71%)
Mutual labels:  cocoa

MPEdn

An EDN (Extensible Data Notation) Objective C I/O library for MacOS and iOS.

The library includes:

  • MPEdnParser, a parser for reading EDN and generating equivalent Cocoa data structures.

  • MPEdnWriter, which writes Cocoa data structures as EDN.

For most uses, parsing EDN is as simple as:

[@"{:a 1}" ednStringToObject];

Which returns the parsed object or nil on error.

And to generate EDN from a Cocoa object:

[myObject objectToEdnString];

See the headers for API docs.

Using It In Your Project

To use the library, use one of (in decreasing order of ease-of-use):

  • Install via CocoaPods: add pod 'MPEDN', '~> 1.0.0' to your Podfile.

  • Use a workspace containing your project and MPEdn as described here. You may also need to add the -all_load flag to the "Other Linker Flags" section of your project if the ednStringToObject and objectToEdnString category methods do not get linked in.

  • Generate libMPEdn.a using the supplied Xcode project and copy that and the .h files to your project.

EDN To Cocoa Mapping

  • EDN map <-> NSDictionary (but see [MPEdnParser newDictionary] to override).

  • EDN list or vector <-> NSArray (but see [MPEdnParser newArray] to override).

  • EDN set <-> NSSet (but see [MPEdnParser newSet] to override).

  • EDN string <-> NSString.

  • EDN float <-> NSNumber (numberWithDouble).

  • EDN int <-> NSNumber (numberWithLong). The N (bigint) suffix is not supported.

  • EDN decimal ('M' suffix, BigDecimal in Clojure) <-> NSDecimalNumber.

  • EDN boolean <-> NSNumber (numberWithBool).

  • EDN character <-> NSNumber (numberWithUnsignedChar).

  • EDN keyword <-> MPEdnKeyword. If the MPEdnWriter.useKeywordsInMaps property is true (the default is false as of 0.2), strings used as keys in NSDictionary will be output as keywords if possible. Note that strings and keywords never compare as equal, so this could get confusing when reading a dictionary from an external service that uses keywords: in general, prefer explicit use of keywords where possible.

  • EDN symbol <-> MPEdnSymbol.

  • EDN tagged values can be translated by tag reader/writer classes implementing MPEdnTaggedValueWriter and/or MPEdnTaggedValueReader (see MPEdnBase64Codec for an example). You can accept any tag regardless of whether there is a reader for it or not by setting the allowUnknownTags property on MPEdnParser, which will represent unknown tagged values with MPEdnTaggedValue instances. MPEdnWriter knows how to output MPEdnTaggedValue's which enables round-tripping of EDN with unknown tags.

Notes

  • Symbols would probably be better handled in future by resolving them to a mapped value, either through a symbol table or a user-defined callback.

  • Floats are output in full to avoid loss of precision.

  • Newlines in strings are output in their escaped form (\n rather than a raw 0x0a) even though the raw form is legal in order to make it straightforward to use generated EDN strings in line-oriented protocols.

  • The parser and writer fully support all Unicode code points in string values (i.e. both 'normal' characters and UTF-16 surrogate pairs), but not elsewhere. Adding general support would be straightforward, at the cost of some speed, but since EDN syntax is defined in terms of ASCII character classes it's not clear that using anything but ASCII outside of strings would be valid EDN in any case.

Author And License

MPEdn is developed by Matthew Phillips ([email protected]). It is licensed under the same open source license as Clojure, the Eclipse Public License v1.0 .

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].