int SignPart__Uno_Time_Text_LocalDatePattern_LocalDateBucket__Read(SignPart__Uno_Time_Text_LocalDatePattern_LocalDateBucket* __this, ::uString* line, int position, ::app::Uno::Time::Text::LocalDatePattern_LocalDateBucket* value)
{
    if ((position + 1) >= ::uPtr< ::uString*>(line)->Length())
    {
        if (__this->Obligatory())
        {
            U_THROW(::app::Uno::FormatException__New_3(NULL, ::uGetConstString("Wrong number format")));
        }

        return 0;
    }

    ::uChar character = ::uPtr< ::uString*>(line)->Item(position);

    switch (character)
    {
        case '-':
        case '+':
        {
            __this->Set(value, (character == '-') ? -1 : 1);
            return 1;
        }
    }

    if (__this->Obligatory())
    {
        U_THROW(::app::Uno::FormatException__New_3(NULL, ::uGetConstString("Wrong number format")));
    }

    __this->Set(value, 1);
    return 0;
}
Exemplo n.º 2
0
// public static string Read(string filename) [static] :32
uString* ApplicationDir::Read(uString* filename)
{
    if (::g::Uno::String::op_Equality(filename, NULL))
        U_THROW(::g::Uno::ArgumentNullException::New6(::STRINGS[0/*"filename"*/]));

    uString* filepath = ::g::Uno::IO::Path::Combine(::g::Uno::IO::Directory::GetUserDirectory(1), filename);

    if (::g::Uno::IO::File::Exists(filepath))
        return ::g::Uno::IO::File::ReadAllText(filepath);
    else
        U_THROW(::g::Uno::Exception::New2(::STRINGS[1/*"File does n...*/]));
}
Exemplo n.º 3
0
// public static bool Write(string filename, string value) [static] :11
bool ApplicationDir::Write(uString* filename, uString* value)
{
    if (::g::Uno::String::op_Equality(filename, NULL))
        U_THROW(::g::Uno::ArgumentNullException::New6(::STRINGS[0/*"filename"*/]));

    if (::g::Uno::String::op_Equality(value, NULL))
        U_THROW(::g::Uno::ArgumentNullException::New6(::STRINGS[2/*"value"*/]));

    uString* filepath = ::g::Uno::IO::Path::Combine(::g::Uno::IO::Directory::GetUserDirectory(1), filename);
    ApplicationDir::CreateFile(filepath);
    ::g::Uno::IO::File::WriteAllText(filepath, value);
    return true;
}
// public override sealed int Receive(byte[] buffer, int offset, int length) :296
void Socket__Receive1_fn(Socket* __this, uArray* buffer, int* offset, int* length, int* __retval)
{
    int offset_ = *offset;
    int length_ = *length;

    if ((offset_ + length_) > uPtr(buffer)->Length())
        U_THROW(::g::Uno::ArgumentOutOfRangeException::New6(::STRINGS[0/*"Offset and ...*/]));

    int result = ::g::Uno::Net::Sockets::Berkeley::bsd_socket::Receive(__this->_handle, buffer, offset_, length_);

    if (-1 == result)
        U_THROW(::g::Uno::Net::Sockets::SocketException::New4(::g::Uno::Net::Sockets::Berkeley::bsd_socket::GetError()));

    return *__retval = result, void();
}
int BlendModeHelpers__GetSrcAlpha(::uStatic* __this, int mode)
{
    switch (mode)
    {
        case 0:
        {
            return 1;
        }
        case 1:
        {
            return 1;
        }
        case 2:
        {
            return 1;
        }
        case 3:
        {
            return 1;
        }
        default:
        {
            U_THROW(::app::Uno::Exception__New_1(NULL, BlendModeHelpers___invalidBlendMode));
        }
    }
}
Exemplo n.º 6
0
// public byte[] ReadBytes(int byteCount) [instance] :57
uArray* BinaryReader::ReadBytes(int byteCount)
{
    if (byteCount < 0)
        U_THROW(::g::Uno::ArgumentOutOfRangeException::New6(::STRINGS[0/*"byteCount"*/]));

    uArray* buffer = uArray::New(::TYPES[0/*byte[]*/], byteCount);
    int offset = 0;

    do
    {
        int read = uPtr(_stream)->Read(buffer, offset, byteCount - offset);
        offset = offset + read;

        if (read == 0)
            break;
    }
    while (offset < byteCount);

    if (offset == byteCount)
        return buffer;

    uArray* result = uArray::New(::TYPES[0/*byte[]*/], offset);

    for (int i = 0; i < offset; i++)
        uPtr(result)->Item<uint8_t>(i) = uPtr(buffer)->Item<uint8_t>(i);

    return result;
}
Mutex* Mutex__Create(::uStatic* __this)
{
    {
        return (Mutex*)::app::Uno::Threading::POSIXMutex__New_1(NULL);
    }

    U_THROW(::app::Uno::Exception__New_2(NULL, ::uGetConstString("Feature not supported in this backend")));
}
Thread* Thread__Create(::uStatic* __this, ::uDelegate* callback)
{
    {
        return (Thread*)::app::Uno::Threading::POSIXThread__New_1(NULL, callback);
    }

    U_THROW(::app::Uno::Exception__New_2(NULL, ::uGetConstString("Feature not supported in this backend")));
}
Exemplo n.º 9
0
void GLHelper::AssertValidContext()
{
    EGLContext cntx = eglGetCurrentContext();
    if (cntx != GLHelper::_eglPBufferContext && cntx != GLHelper::_eglSurfaceContext)
    {
        U_THROW(::g::Uno::Exception::New2(uNewStringUtf8("GLHelper::AssertValidContext: Invalid GL context. Not our pbuffer context or surface context",92)));
    }
}
Exemplo n.º 10
0
// public override sealed void Write(byte[] src, int byteOffset, int byteCount) :175
void NetworkStream__Write_fn(NetworkStream* __this, uArray* src, int* byteOffset, int* byteCount)
{
    int byteOffset_ = *byteOffset;
    int byteCount_ = *byteCount;
    int sent = uPtr(__this->_socket)->Send1(src, byteOffset_, byteCount_);

    if (sent != byteCount_)
        U_THROW(::g::Uno::Exception::New2(::STRINGS[0/*"sent != byt...*/]));
}
void POSIXMutex__Unlock(POSIXMutex* __this)
{
    if (::app::Uno::IntPtr__op_Equality(NULL, __this->_handle, ::app::Uno::IntPtr__Zero))
    {
        U_THROW(::app::Uno::Exception__New_1(NULL));
    }

    __this->UnlockImpl(__this->_handle);
}
void Thread__Sleep(::uStatic* __this, int millis)
{
    {
        ::app::Uno::Threading::POSIXThread__Sleep_1(NULL, millis);
        return;
    }

    U_THROW(::app::Uno::Exception__New_2(NULL, ::uGetConstString("Feature not supported in this backend")));
}
Exemplo n.º 13
0
// private void FillBuffer(int byteCount) [instance] :38
void BinaryReader::FillBuffer(int byteCount)
{
    if ((byteCount < 0) || (byteCount > 64))
        U_THROW(::g::Uno::ArgumentOutOfRangeException::New6(::STRINGS[0/*"byteCount"*/]));

    int offset = 0;

    do
    {
        int read = uPtr(_stream)->Read(_buffer, offset, byteCount - offset);

        if (read == 0)
            U_THROW(::g::Uno::IO::EndOfStreamException::New5());

        offset = offset + read;
    }
    while (offset < byteCount);
}
bool ModelMeshCollision__RayIntersectsModelMesh(::uStatic* __this, ::app::Uno::Geometry::Ray objRay, ::app::Uno::Content::Models::ModelMesh* modelMesh, float* outDistance)
{
    if (modelMesh == NULL)
    {
        U_THROW(::app::Uno::Exception__New_1(NULL, ::uGetConstString("modelMesh can not be null")));
    }

    bool useIndices = ::uPtr< ::app::Uno::Content::Models::ModelMesh*>(modelMesh)->IndexCount() > 0;
    return useIndices ? ::uPtr< ::app::Fuse::Entities::ModelMeshCollision_Indexed*>(::app::Fuse::Entities::ModelMeshCollision_Indexed__New_1(NULL, modelMesh->Positions(), modelMesh->Indices(), modelMesh->IndexCount()))->IntersectsRay(objRay, outDistance) : ::uPtr< ::app::Fuse::Entities::ModelMeshCollision_Direct*>(::app::Fuse::Entities::ModelMeshCollision_Direct__New_1(NULL, modelMesh->Positions(), modelMesh->VertexCount()))->IntersectsRay(objRay, outDistance);
}
void POSIXThread__StartImpl(POSIXThread* __this, ::uULong* handle, ::uDelegate* callback)
{
    if (*handle != 0ull)
    {
        U_THROW(::app::Uno::Exception__New_2(NULL, ::uGetConstString("Cannot start throw more than once")));
    }

    ::uPtr< ::app::Uno::Collections::List__Uno_Action*>(POSIXThread___callbacks)->Add(callback);
    int result = thread_start(handle, callback);
}
Exemplo n.º 16
0
 void __Register_Finalizer()
 {
     JNIEnv* jni = ::g::Android::Base::JNI::GetEnvPtr();
     JNINativeMethod nativeFunc = {(char* const)"Finalize", (char* const)"(J)V", (void *)&__JWrapper_Finalizer};
     jclass cls = reinterpret_cast<jclass>(jni->NewGlobalRef(::g::Android::Base::JNI::LoadClass(::g::Android::Base::JNI::GetEnvPtr(), "com.Bindings.UnoHelper")));
     jint attached = ::g::Android::Base::JNI::GetEnvPtr()->RegisterNatives(cls, &nativeFunc, 1);
     if (attached < 0) {
         U_THROW(::g::Uno::Exception::New2(uNewStringUtf8("Could not register the instantiation callback function",54)));
     }
 }
void Capturer___ObjInit(Capturer* __this, ::app::Fuse::Node* n, ::uObject* identity, ::uDelegate* lostCallback)
{
    if (((n == NULL) || (identity == NULL)) || ::app::Uno::Delegate__op_Equality(NULL, (::uDelegate*)lostCallback, NULL))
    {
        U_THROW(::app::Uno::Exception__New_1(NULL, ::uGetConstString("Invalid Capturer parameters")));
    }

    __this->Node(n);
    __this->Identity(identity);
    __this->LostCallback(lostCallback);
}
// public override sealed int Send(byte[] buffer, int offset, int length) :279
void Socket__Send1_fn(Socket* __this, uArray* buffer, int* offset, int* length, int* __retval)
{
    int offset_ = *offset;
    int length_ = *length;
    int result = ::g::Uno::Net::Sockets::Berkeley::bsd_socket::Send1(__this->_handle, buffer, offset_, length_);

    if (-1 == result)
        U_THROW(::g::Uno::Net::Sockets::SocketException::New4(::g::Uno::Net::Sockets::Berkeley::bsd_socket::GetError()));

    return *__retval = result, void();
}
void MeshBuilder__AddVertex(MeshBuilder* __this, float x, float y)
{
    if ((x != x) || (y != y))
    {
        U_THROW(::app::Uno::Exception__New_1(NULL, ::uGetConstString("Vertex was NaN")));
    }

    ::app::Fuse::Drawing::Tesselation::HalfEdge* e = (__this->_lastEdge != NULL) ? ::uPtr< ::app::Fuse::Drawing::Tesselation::HalfEdge*>(__this->_lastEdge)->Split() : __this->CreateSelfLoop();
    ::uPtr< ::app::Fuse::Drawing::Tesselation::Vertex*>(::uPtr< ::app::Fuse::Drawing::Tesselation::HalfEdge*>(e)->Origin())->S = (double)x;
    ::uPtr< ::app::Fuse::Drawing::Tesselation::Vertex*>(e->Origin())->T = (double)y;
    e->Winding(1);
    ::uPtr< ::app::Fuse::Drawing::Tesselation::HalfEdge*>(e->Sym())->Winding(-1);
    __this->_lastEdge = e;
}
void LoadingImageSource__set_Policy(LoadingImageSource* __this, ::app::Fuse::Resources::DisposalPolicy* value)
{
    if (value == NULL)
    {
        U_THROW(::app::Uno::Exception__New_1(NULL, ::uGetConstString("value-cannot-be-null")));
    }

    __this->_policy = value;

    if (__this->_disposable != NULL)
    {
        ::uPtr< ::app::Fuse::Resources::LoadingImageSource_SourceDisposable*>(__this->_disposable)->Policy = __this->_policy;
    }
}
::uString* NumberPart__Uno_Time_Text_LocalDatePattern_LocalDateBucket__GetPart(NumberPart__Uno_Time_Text_LocalDatePattern_LocalDateBucket* __this, ::uString* line, int index)
{
    if ((index + __this->ExpectedSize()) > ::uPtr< ::uString*>(line)->Length())
    {
        if (__this->Obligatory())
        {
            U_THROW(::app::Uno::FormatException__New_3(NULL, ::app::Uno::String__op_Addition_1(NULL, ::uGetConstString("Not enough symbols at "), ::uBox< int>(::app::Uno::Int__typeof(), index))));
        }

        return ::app::Uno::String__Empty;
    }

    return ::app::Uno::String::Substring_1(::uPtr< ::uString*>(line), index, __this->ExpectedSize());
}
void Change__float___ObjInit_2(Change__float* __this, ::app::Uno::UX::Property__float* target)
{
    ::app::Fuse::Animations::ProgressAnimator___ObjInit_1(__this);

    if (target == NULL)
    {
        U_THROW(::app::Uno::ArgumentNullException__New_5(NULL, ::uGetConstString("target")));
    }

    __this->Target(target);

    if (!__this->IsContinuous())
    {
        __this->Mixer = ::app::Fuse::Animations::Mixer__get_DefaultDiscrete(NULL);
    }
}
int NumberPart__Uno_Time_Text_LocalDatePattern_LocalDateBucket__Read(NumberPart__Uno_Time_Text_LocalDatePattern_LocalDateBucket* __this, ::uString* line, int position, ::app::Uno::Time::Text::LocalDatePattern_LocalDateBucket* value)
{
    ::uString* part = __this->GetPart(line, position);

    if (::app::Uno::String__IsNullOrEmpty(NULL, part))
    {
        if (__this->Obligatory())
        {
            U_THROW(::app::Uno::FormatException__New_3(NULL, ::app::Uno::String__op_Addition_1(NULL, ::uGetConstString("Not found number at "), ::uBox< int>(::app::Uno::Int__typeof(), position))));
        }

        return 0;
    }

    __this->Set(value, ::app::Uno::Int__Parse(NULL, part));
    return __this->ExpectedSize();
}
Exemplo n.º 24
0
// protected internal int Read7BitEncodedInt() [instance] :333
int BinaryReader::Read7BitEncodedInt()
{
    int count = 0;
    int shift = 0;

    while (shift != 35)
    {
        uint8_t b = ReadByte();
        count = count | ((int)(b & 127) << shift);
        shift = shift + 7;

        if ((b & 128) == 0)
            return count;
    }

    U_THROW(::g::Uno::FormatException::New4(::STRINGS[1/*"Invalid 7 b...*/]));
}
::uByte StringCache__CacheString(StringCache* __this, ::uString* s)
{
    int stringHash = ::uPtr< ::uString*>(s)->GetHashCode();
    ::uShort leastUsedIndex = -1;
    ::uShort availableIndex = -1;
    double maxIdle = 0.0;

    for (::uByte b = 0; (int)b < ::uPtr< ::uArray*>(__this->_cache)->Length(); b++)
    {
        ::app::Fuse::StringCache_Cache* c = ::uPtr< ::uArray*>(__this->_cache)->Item< ::app::Fuse::StringCache_Cache*>((int)b);

        if (c == NULL)
        {
            availableIndex = (::uShort)b;
        }
        else if (::uPtr< ::app::Fuse::StringCache_Cache*>(c)->StringHash() == stringHash)
        {
            ::uPtr< ::app::Fuse::StringCache_Cache*>(c)->UpdateLastTimeUsed();
            return b;
        }
        else
        {
            double idleTime = ::uPtr< ::app::Fuse::StringCache_Cache*>(c)->IdleTime();

            if (maxIdle < idleTime)
            {
                maxIdle = idleTime;
                leastUsedIndex = (::uShort)b;
            }
        }
    }

    if (availableIndex != -1)
    {
        ::uPtr< ::uArray*>(__this->_cache)->ItemStrong< ::app::Fuse::StringCache_Cache*>((int)availableIndex) = ::app::Fuse::StringCache_Cache__New_1(NULL, s);
        return (::uByte)availableIndex;
    }
    else if (leastUsedIndex != -1)
    {
        ::uPtr< ::uArray*>(__this->_cache)->ItemStrong< ::app::Fuse::StringCache_Cache*>((int)leastUsedIndex) = ::app::Fuse::StringCache_Cache__New_1(NULL, s);
        return (::uByte)leastUsedIndex;
    }

    U_THROW(::app::Uno::Exception__New_1(NULL, ::app::Uno::String__op_Addition_1(NULL, ::app::Uno::String__op_Addition(NULL, ::app::Uno::String__op_Addition_1(NULL, ::uGetConstString("String cache error, leastUsedIndex="), ::uBox< ::uShort>(::app::Uno::Short__typeof(), leastUsedIndex)), ::uGetConstString(", availableIndex=")), ::uBox< ::uShort>(::app::Uno::Short__typeof(), availableIndex))));
}
// private static void EnsureInitialized() [static] :38
void JavaUnoObject::EnsureInitialized()
{
    uStackFrame __("Uno.Compiler.ExportTargetInterop.Foreign.Android.JavaUnoObject", "EnsureInitialized()");

    if (::uEnterCriticalIfNull(&JavaUnoObject::_unoObjectClass()))
    {
        ::g::Android::Base::JNI::Init();
        JavaUnoObject::_unoObjectClass() = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[0/*"com/Binding...*/], false));
        JavaUnoObject::_unoObjectConstructor() = ::g::Android::Base::JNI::GetMethodID(JavaUnoObject::_unoObjectClass(), ::STRINGS[1/*"<init>"*/], ::STRINGS[2/*"(J)V"*/]);
        JavaUnoObject::_unoObjectGetRetainedUnoPtr() = ::g::Android::Base::JNI::GetMethodID(JavaUnoObject::_unoObjectClass(), ::STRINGS[3/*"_GetRetaine...*/], ::STRINGS[4/*"()J"*/]);
        JNINativeMethod nativeFunc = {(char* const)"Finalize", (char* const)"(J)V", (void *)&__JavaUnoObject_Finalizer};
        int attached = ::g::Android::Base::JNI::GetEnvPtr()->RegisterNatives(JavaUnoObject::_unoObjectClass(), &nativeFunc, 1);

        if (attached < 0)
            U_THROW(::g::Uno::Exception::New2(::STRINGS[5/*"Could not r...*/]));

        ::uExitCritical();;
    }
}
Exemplo n.º 27
0
// public static bool Delete(string filename) [static] :44
bool ApplicationDir::Delete(uString* filename)
{
    if (::g::Uno::String::op_Equality(filename, NULL))
        U_THROW(::g::Uno::ArgumentNullException::New6(::STRINGS[0/*"filename"*/]));

    uString* filepath = ::g::Uno::IO::Path::Combine(::g::Uno::IO::Directory::GetUserDirectory(1), filename);

    if (!::g::Uno::IO::File::Exists(filepath))
        return false;

    try
    {
        ::g::Uno::IO::File::Delete(filepath);
        return true;
    }
    catch (const uThrowable& __t)
    {
        ::g::Uno::Exception* e = __t.Exception;
    }

    return false;
}
bool HashSet1_Enumerator__Fuse_IFlush__MoveNext(HashSet1_Enumerator__Fuse_IFlush* __this)
{
    if (__this->_version != ::uPtr< ::app::Uno::Collections::Dictionary__Fuse_IFlush__bool*>(__this->_source)->_version)
    {
        U_THROW(::app::Uno::InvalidOperationException__New_4(NULL, ::uGetConstString("Collection was modified")));
    }

    do
    {
        __this->_iterator++;

        if (__this->_iterator >= ::uPtr< ::uArray*>(::uPtr< ::app::Uno::Collections::Dictionary__Fuse_IFlush__bool*>(__this->_source)->_buckets)->Length())
        {
            return false;
        }
    }
    while (::uPtr< ::uArray*>(::uPtr< ::app::Uno::Collections::Dictionary__Fuse_IFlush__bool*>(__this->_source)->_buckets)->Item< ::app::Uno::Collections::Dictionary2_Bucket__Fuse_IFlush__bool>(__this->_iterator).State != 1);

    ::app::Uno::Collections::Dictionary2_Bucket__Fuse_IFlush__bool bucket = ::uPtr< ::uArray*>(::uPtr< ::app::Uno::Collections::Dictionary__Fuse_IFlush__bool*>(__this->_source)->_buckets)->Item< ::app::Uno::Collections::Dictionary2_Bucket__Fuse_IFlush__bool>(__this->_iterator);
    __this->_current = bucket.Key;
    return true;
}
Exemplo n.º 29
0
void uType::Init()
{
    switch (State)
    {
    case uTypeStateInitialized:
        return;
    case uTypeStateInitializing:
    {
        Xli::MutexLock lock(_Mutex);
        // TODO: throw TypeInitializationException instead
        if (State != uTypeStateInitialized && uSwapThreadType(this) != this)
            U_THROW(::g::Uno::Exception::New2(uString::Const(FullName)));
        break;
    }
    default:
    {
        Xli::MutexLock lock(_Mutex);

        if (Base && Base->State < uTypeStateInitializing)
        {
            Base->Init();
            if (State == uTypeStateInitialized)
                return;
        }

        Build();
        State = uTypeStateInitializing;
        uType* last = uSwapThreadType(this);

        if (fp_cctor_)
            (*fp_cctor_)(this);

        State = uTypeStateInitialized;
        uSwapThreadType(last);
        break;
    }
    }
}
bool Dictionary2_KeyCollection__char__Uno_Content_Fonts_BitmapFont_GlyphInfo__Uno_Collections_ICollection_Remove(Dictionary2_KeyCollection__char__Uno_Content_Fonts_BitmapFont_GlyphInfo* __this, ::uChar item)
{
    U_THROW(::app::Uno::InvalidOperationException__New_3(NULL));
}