Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QtAndroidExtras Source: Why some functions get QByteArray parameter?
QtWS25 Last Chance

QtAndroidExtras Source: Why some functions get QByteArray parameter?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 3 Posters 472 Views
  • 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 Offline
    I Offline
    Ibrahim
    wrote on last edited by
    #1

    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
    0
    • ArtmeticA Offline
      ArtmeticA Offline
      Artmetic
      wrote on last edited by
      #2

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

      jsulmJ 1 Reply Last reply
      1
      • ArtmeticA Artmetic

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

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @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
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved