# SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved.
# Non-Commercial Freeware and Commercial Software.
# This class is generated using the converter UniSharping (www.unisharping.ru) from Pullenti C# project.
# The latest version of the code is available on the site www.pullenti.ru

from pullenti.unisharp.Misc import RefOutArgWrapper
from pullenti.unisharp.Streams import Stream

from pullenti.util.MiscHelper import MiscHelper
from pullenti.unitext.internal.pdf.PdfObject import PdfObject

class PdfRealValue(PdfObject):
    
    def __init__(self) -> None:
        super().__init__()
        self.val = None;
    
    def get_double(self) -> float:
        res = 0
        wrapres235 = RefOutArgWrapper(0)
        inoutres236 = MiscHelper.try_parse_double(self.val, wrapres235)
        res = wrapres235.value
        if (not inoutres236): 
            return 0
        return res
    
    def to_string_ex(self, lev : int) -> str:
        return self.val
    
    def is_simple(self, lev : int) -> bool:
        return True
    
    def write0_(self, s : Stream) -> None:
        buf = self.val.encode("ASCII", 'ignore')
        s.write(buf, 0, len(buf))