doc/src/snippets/qmake/replacefunction.pro
branchRCL_3
changeset 7 3f74d0d4af4c
parent 0 1918ee327afb
equal deleted inserted replaced
6:dee5afe5301f 7:3f74d0d4af4c
       
     1 #! [0]
       
     2 defineReplace(headersAndSources) {
       
     3     variable = $$1
       
     4     names = $$eval($$variable)
       
     5     headers =
       
     6     sources =
       
     7 
       
     8     for(name, names) {
       
     9         header = $${name}.h
       
    10         exists($$header) {
       
    11             headers += $$header
       
    12         }
       
    13         source = $${name}.cpp
       
    14         exists($$source) {
       
    15             sources += $$source
       
    16         }
       
    17     }
       
    18     return($$headers $$sources)
       
    19 }
       
    20 #! [0]
       
    21 
       
    22 defineReplace(matchingFiles) {
       
    23     names = $$ARGS
       
    24     files =
       
    25 
       
    26     for(name, names) {
       
    27         header = $${name}.h
       
    28         source = $${name}.cpp
       
    29         exists($$header):exists($$source) {
       
    30             files += $$header
       
    31             files += $$source
       
    32         }
       
    33     }
       
    34     return($$files)
       
    35 }
       
    36 
       
    37 names = delegate model view main
       
    38 message(Finding all headers and sources from the following list of names:)
       
    39 message($$names)
       
    40 allFiles = $$headersAndSources(names)
       
    41 message(Found: $$allFiles)
       
    42 
       
    43 message(Finding only matching headers and sources from the following list of names:)
       
    44 message($$names)
       
    45 matching = $$matchingFiles($$names)
       
    46 message(Found: $$matching)