class-design

Class design

Each class in the Intl::CLDR namespace should have an almost identical structure. This document serves to describe and document it.

=begin pod
    The POD section should describe any design decisions that were
    made for the class particularly as it may differ from other
    implementations.  For instance, if the class ignores an alternate
    type in its import/export process, modifies an element or type's
    name (e.g. "-1" as "one-less"), or only provides hashy/listy
    access, describe it here with an example.
=end pod

#| Explanation of the class
#| Relate it directly to a CLDR element.
class CLDR-Foo is CLDR-Item {

    # Every class (except Base) has a parent.  To avoid circular dependencies
    # this is untyped, so type information should be included in declarator POD
    has $!parent; #= The CLDR-Bar that contains this CLDR-Foo

    # Then include each logical attribute, typing it accordingly
    has Xyz $.attribute; #= Use POD to give it information

    #| Creates a new CLDR-Foo
    method new(\blob, $offset is raw) {
        # If any attributes are strings, use the string coder
        use Intl::CLDR::Util::StringCoder;
        use Intl::CLDR::Xyz; # and of course each class represented




    }


    # The generator methods are by default commented out.  They MUST be surrounded
    # by the initial text that you see.  When updating the CLDR database, the
    # code will be uncommented out (ironically, but commenting out the comment ha)
    # This process keeps the methods out of distribution.

    #`<<<<< GENERATOR METHODS
    #| Binary encodes a CLDR-Foo from a flattened CLDR Hash
    method encode(\hash --> buf8) {
        # This method creates a binary encoding, and returns a buf8.
        # It can store things however it wants, so long as the new method
        # can interpret it.  The following is a rough outline of how it's
        # normally done:

        my $result = buf8.new;
        for hash.kv -> \key, \value {
            given key {
                                        #  β†™οΈŽ A unique identifier for decoding
                when 'a' { CLDR-A.encode(value).prepend: 1 }
                when 'b' { CLDR-B.encode(value).prepend: 2 }
                when 'c' { CLDR-B.encode(value).prepend: 3 }
                when 's' { StringBuilder::get(value).prepend: 4 }
                default  { die "Unknown value passed to CLDR-Dates encoder" }
            }
        }
        # Using a 0 is the easiest way to create things
        return $result.append: 0
    }




    >>>>># GENERATOR METHODS

}

Intl::CLDR v0.7.2

A module providing access to the Unicode Common Language Data Repository

Authors

  • Matthew β€˜MatΓ©u’ Stephen STUCKWISCH

License

Artistic-2.0

Dependencies

Intl::LanguageTag:auth<zef:guifa>:ver<0.12.1+>Intl::UserLanguage:auth<zef:guifa>:ver<0.4.0+>

Test Dependencies

Provides

  • Intl::CLDR
  • Intl::CLDR::Core
  • Intl::CLDR::Enums
  • Intl::CLDR::Genders
  • Intl::CLDR::NumberSystems::Digits
  • Intl::CLDR::NumberSystems::Ge'ez
  • Intl::CLDR::NumberSystems::Mayan
  • Intl::CLDR::NumberSystems::Roman
  • Intl::CLDR::Types::AppendItems
  • Intl::CLDR::Types::AvailableFormats
  • Intl::CLDR::Types::Calendar
  • Intl::CLDR::Types::Calendars
  • Intl::CLDR::Types::Characters
  • Intl::CLDR::Types::CompoundUnitSet
  • Intl::CLDR::Types::CompoundUnits
  • Intl::CLDR::Types::ContextTransformUsage
  • Intl::CLDR::Types::ContextTransforms
  • Intl::CLDR::Types::CoordinateWidth
  • Intl::CLDR::Types::Coordinates
  • Intl::CLDR::Types::Currencies
  • Intl::CLDR::Types::Currency
  • Intl::CLDR::Types::CurrencyFormatSystem
  • Intl::CLDR::Types::CurrencyFormats
  • Intl::CLDR::Types::CyclicNameContext
  • Intl::CLDR::Types::CyclicNameSet
  • Intl::CLDR::Types::CyclicNameSets
  • Intl::CLDR::Types::CyclicNameWidth
  • Intl::CLDR::Types::Database
  • Intl::CLDR::Types::DateFormat
  • Intl::CLDR::Types::DateFormats
  • Intl::CLDR::Types::DateTimeFormat
  • Intl::CLDR::Types::DateTimeFormats
  • Intl::CLDR::Types::Dates
  • Intl::CLDR::Types::DayContext
  • Intl::CLDR::Types::DayPeriodContext
  • Intl::CLDR::Types::DayPeriodRule
  • Intl::CLDR::Types::DayPeriodRuleSets
  • Intl::CLDR::Types::DayPeriodRules
  • Intl::CLDR::Types::DayPeriodWidth
  • Intl::CLDR::Types::DayPeriods
  • Intl::CLDR::Types::DayWidth
  • Intl::CLDR::Types::Days
  • Intl::CLDR::Types::DecimalFormatSystem
  • Intl::CLDR::Types::DecimalFormats
  • Intl::CLDR::Types::Delimiters
  • Intl::CLDR::Types::Derivation
  • Intl::CLDR::Types::DerivationComponent
  • Intl::CLDR::Types::DerivationCompound
  • Intl::CLDR::Types::Derivations
  • Intl::CLDR::Types::Durations
  • Intl::CLDR::Types::Ellipses
  • Intl::CLDR::Types::EraWidth
  • Intl::CLDR::Types::Eras
  • Intl::CLDR::Types::ExemplarCharacters
  • Intl::CLDR::Types::ExtensionName
  • Intl::CLDR::Types::ExtensionNames
  • Intl::CLDR::Types::Field
  • Intl::CLDR::Types::FieldWidth
  • Intl::CLDR::Types::Fields
  • Intl::CLDR::Types::Grammar
  • Intl::CLDR::Types::IntervalFormat
  • Intl::CLDR::Types::IntervalFormats
  • Intl::CLDR::Types::Language
  • Intl::CLDR::Types::LanguageGroups
  • Intl::CLDR::Types::LanguageNames
  • Intl::CLDR::Types::Languages
  • Intl::CLDR::Types::Layout
  • Intl::CLDR::Types::ListPattern
  • Intl::CLDR::Types::ListPatternWidth
  • Intl::CLDR::Types::ListPatterns
  • Intl::CLDR::Types::LocaleDisplayNames
  • Intl::CLDR::Types::LocaleDisplayPatterns
  • Intl::CLDR::Types::LocaleExtensionTypes
  • Intl::CLDR::Types::MeasurementSystemNames
  • Intl::CLDR::Types::Messages
  • Intl::CLDR::Types::Metazones
  • Intl::CLDR::Types::MinimalPairs
  • Intl::CLDR::Types::MiscellaneousPatternSet
  • Intl::CLDR::Types::MiscellaneousPatterns
  • Intl::CLDR::Types::MonthContext
  • Intl::CLDR::Types::MonthPatternContext
  • Intl::CLDR::Types::MonthPatternWidth
  • Intl::CLDR::Types::MonthPatterns
  • Intl::CLDR::Types::MonthWidth
  • Intl::CLDR::Types::Months
  • Intl::CLDR::Types::NumberFormat
  • Intl::CLDR::Types::NumberFormatSet
  • Intl::CLDR::Types::NumberingSystems
  • Intl::CLDR::Types::Numbers
  • Intl::CLDR::Types::Orientation
  • Intl::CLDR::Types::PercentFormatSystem
  • Intl::CLDR::Types::PercentFormats
  • Intl::CLDR::Types::PluralRangeRuleSet
  • Intl::CLDR::Types::PluralRuleSet
  • Intl::CLDR::Types::Plurals
  • Intl::CLDR::Types::Posix
  • Intl::CLDR::Types::QuarterContext
  • Intl::CLDR::Types::QuarterWidth
  • Intl::CLDR::Types::Quarters
  • Intl::CLDR::Types::RegionFormat
  • Intl::CLDR::Types::RelativeTime
  • Intl::CLDR::Types::ScientificFormatSystem
  • Intl::CLDR::Types::ScientificFormats
  • Intl::CLDR::Types::ScriptNames
  • Intl::CLDR::Types::SimpleUnitSet
  • Intl::CLDR::Types::SimpleUnits
  • Intl::CLDR::Types::Subdivision
  • Intl::CLDR::Types::Subdivisions
  • Intl::CLDR::Types::Supplement
  • Intl::CLDR::Types::SymbolSet
  • Intl::CLDR::Types::Symbols
  • Intl::CLDR::Types::TerritoryNames
  • Intl::CLDR::Types::TimeFormat
  • Intl::CLDR::Types::TimeFormats
  • Intl::CLDR::Types::TimezoneMaps
  • Intl::CLDR::Types::TimezoneNames
  • Intl::CLDR::Types::Units
  • Intl::CLDR::Types::VariantNames
  • Intl::CLDR::Types::WindowsZoneMap
  • Intl::CLDR::Types::WindowsZoneMaps
  • Intl::CLDR::Types::Zone
  • Intl::CLDR::Types::ZoneWidth
  • Intl::CLDR::Types::Zones
  • Intl::CLDR::Util::StrDecode
  • Intl::CLDR::Util::StrEncode
  • Intl::CLDR::Util::XML-Helper

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.