Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QtAndroidExtras Source: Why some functions get QByteArray parameter?

    Mobile and Embedded
    3
    3
    318
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      Ibrahim last edited by

      Hi; I saw some functions like this in qjni.cpp:

      static jclass getCachedClass(const QByteArray &classBinEnc, bool *isCached = 0)
      {
        ...
      }
      
      inline static jclass loadClass(const QByteArray &className, JNIEnv *env, bool binEncoded = false)
      {
        ...
      }
      

      I don't know why this functions get QByteArray parameter for class name? Class name can be QString, std::string or const char*? Thanks.

      1 Reply Last reply Reply Quote 0
      • Artmetic
        Artmetic last edited by

        maybe because of many diffrient languages (UTF, WIN-1250 ect.).

        jsulm 1 Reply Last reply Reply Quote 1
        • jsulm
          jsulm Lifetime Qt Champion @Artmetic last edited by

          @Artmetic QString is 16bit Unicode, so it can handle different languages and encodings.
          @Ibrahim I'm not JNI expert, but maybe the reason is that Qt needs to communicate with Java (JRE) and QByteArray is just an array of bytes - quite universal.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply Reply Quote 1
          • First post
            Last post