Class PlatformSerializerUtil

    • Method Detail

      • readColor

        public static Color readColor​(IListInStream lis,
                                      Version runtimeVersion,
                                      org.eclipse.xtext.scoping.IGlobalScopeProvider scopeProvider)
        Reads Color
        Parameters:
        lis - stream for reading, can't be null
        runtimeVersion - actual runtime configuration version, can't be null
        scopeProvider - actual IGlobalScopeProvider, can't be null
        Returns:
        read Color from the stream, never null
      • writeColor

        public static void writeColor​(IListOutStream los,
                                      Color color,
                                      boolean withoutStyleItem)
        Writes Color to the stream
        Parameters:
        los - actual stream, can't be null
        color - writing Color, can't be null
        withoutStyleItem - true if we need replace StyleItem in serialization to concrete value, false otherwise
      • readBorder

        public static Border readBorder​(IListInStream lis,
                                        Version runtimeVersion,
                                        org.eclipse.xtext.scoping.IGlobalScopeProvider scopeProvider)
        Reads Border
        Parameters:
        lis - stream for reading, can't be null
        runtimeVersion - actual runtime configuration version, can't be null
        scopeProvider - actual IGlobalScopeProvider, can't be null
        Returns:
        read Border from the stream, never null
      • writeBorder

        public static void writeBorder​(IListOutStream los,
                                       Border border,
                                       boolean withoutStyleItem)
        Writes Border to the stream
        Parameters:
        los - actual stream, can't be null
        border - writing Border, can't be null
        withoutStyleItem - true if we need replace StyleItem in serialization to concrete value, false otherwise
      • readFont

        public static Font readFont​(IListInStream lis,
                                    Version runtimeVersion,
                                    org.eclipse.xtext.scoping.IGlobalScopeProvider scopeProvider)
        Reads Font
        Parameters:
        lis - stream for reading, can't be null
        runtimeVersion - actual runtime configuration version, can't be null
        scopeProvider - actual IGlobalScopeProvider, can't be null
        Returns:
        read Font from the stream, or null if it's default font or font can't be read
      • writeFont

        public static void writeFont​(IListOutStream los,
                                     Font serializeFont,
                                     boolean withoutStyleItem)
        Writes Font to the stream
        Parameters:
        los - actual stream, can't be null
        serializeFont - writing Font, can't be null
        withoutStyleItem - true if we need replace StyleItem in serialization to concrete value, false otherwise
      • readLocalStrings

        public static Map<String,​String> readLocalStrings​(IListInStream lis)
        Reads collection of local strings from stream
        Parameters:
        lis - stream for reading, can't be null
        Returns:
        collection of local strings from stream, never null
      • writeLocalStrings

        public static void writeLocalStrings​(IListOutStream los,
                                             Collection<? extends Map.Entry<String,​String>> localStrings)
        Writes collection of local string to the stream
        Parameters:
        los - stream for writing, can't be null
        localStrings - writing local strings, can't be null
      • getColorByCompositeId

        public static Color getColorByCompositeId​(int platformColorKind,
                                                  CompositeId colorId,
                                                  Version runtimeVersion,
                                                  org.eclipse.xtext.scoping.IGlobalScopeProvider scopeProvider)
        Parameters:
        platformColorKind - kind of the color: win, web, style
        colorId - corresponding to color CompositeId
        runtimeVersion - actual runtime configuration version, can't be null
        scopeProvider - actual IGlobalScopeProvider, can't be null
        Returns:
        read Color, can be null if no color for this CompositeId
      • getFontByCompositeId

        public static Font getFontByCompositeId​(int platformFontKind,
                                                CompositeId fontId,
                                                Version runtimeVersion,
                                                org.eclipse.xtext.scoping.IGlobalScopeProvider scopeProvider)
        Parameters:
        platformFontKind - kind of the font: system, v8_font
        fontId - corresponding to color CompositeId
        runtimeVersion - actual runtime configuration version, can't be null
        scopeProvider - actual IGlobalScopeProvider, can't be null
        Returns:
        read Font, can be null if no font for this CompositeId
      • getBorderByCompositeId

        public static Border getBorderByCompositeId​(int platformBorderKind,
                                                    CompositeId borderId,
                                                    Version runtimeVersion,
                                                    org.eclipse.xtext.scoping.IGlobalScopeProvider scopeProvider)
        Parameters:
        platformBorderKind - kind of the border: style
        fontId - corresponding to color CompositeId
        runtimeVersion - actual runtime configuration version, can't be null
        scopeProvider - actual IGlobalScopeProvider, can't be null
        Returns:
        read Border, can be null if no border for this CompositeId
      • readDate

        public static Date readDate​(IListInStream lis)
        Reads Date
        Parameters:
        lis - stream for reading, can't be null
        Returns:
        read Date from the stream, never null
      • writeDate

        public static void writeDate​(IListOutStream los,
                                     Date date)
        Writes Date to the stream
        Parameters:
        los - actual stream, can't be null
        date - writing Date, can't be null
      • readPicture

        public static Picture readPicture​(IListInStream lis,
                                          Version runtimeVersion)
        Reads Picture
        Parameters:
        lis - stream for reading, can't be null
        runtimeVersion - actual runtime configuration version, can't be null
        Returns:
        read Picture from the stream, or null if picture is not found among standard collection pictures
      • writePicture

        public static void writePicture​(IListOutStream los,
                                        Picture picture)
        Writes Picture to the stream
        Parameters:
        los - actual stream, can't be null
        picture - writing Picture, can't be null
      • MulDiv

        public static int MulDiv​(int nNumber,
                                 int nNumerator,
                                 int nDenominator)
        Multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value. The final result is rounded to the nearest integer. Similar to WinAPi function MulDiv (winbase.h).
        Parameters:
        nNumber - the multiplicand
        nNumerator - the multiplier
        nDenominator - the number by which the result of the multiplication operation is to be divided
        Returns:
        the result of the multiply and devide